question

SachinTah-5685 avatar image
0 Votes"
SachinTah-5685 asked Pedros-4480 edited

Azure Form Recognizer API (v2.1-preview.2) Response Id Not Working

I am using Azure Form Recognizer API version v2.1-preview.2. I am using a custom model which I have trained already.

I used https://{Endpoint}/formrecognizer/v2.1-preview.2/custom/models/{model ID} and get the response 202 properly with header details like apim-request-id and Operation-Location.

However when I use the apim-request-id as response Id in my next API https://{Endpoint}/formrecognizer/v2.1-preview.2/custom/models/{model ID}/analyze/{response id} , replacing response id with apim-request-id I am getting error

{
"error": {
"code": "1020",
"message": "Analyze operation results not found, 'analyzeResultId=2fa30cb9-0c0a-4093-aebe-8c80bb5b1de2'."
}
}


However, using the complete Operation-Location URL received in my first call I am able to get the results. I could see two different Ids, one in response and other in operation location URL.


Is this a bug or I am doing something wrong with respect to result-id?


Sachin



azure-form-recognizer
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

romungi-MSFT avatar image
0 Votes"
romungi-MSFT answered romungi-MSFT commented

@SachinTah-5685 The result id from the analyze response is part of the URL and this needs to be used along with your model id while getting the analyze operation results.

The response from analyze is usually of this format.

 https://eastus.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.2/custom/models/<model_id>/analyzeresults/<result_id>

The request id is not the result id and it would fail if used in get operation results as seen in your response above.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SachinTah-5685 Did you get a chance to use the result id from above and try the scenario again.

0 Votes 0 ·

Hi @romungi-MSFT

I have the same issue. I am calling https://<myformrecognitionservice>.cognitiveservices.azure.com/formrecognizer/v2.1-preview.2/custom/models/633bc685-d91d-4633-b200-30b25caf34e9/analyze and on POST I am getting 202 but on GET (https://<myformrecognitionservice>.cognitiveservices.azure.com/formrecognizer/v2.1-preview.2/custom/models/633bc685-d91d-4633-b200-30b25caf34e9/analyzeResults/d705e5d2-f2aa-4b21-a60f-20ac08c714e2) the same error as described above.

Also I was trying to call through https://westeurope.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-1-preview-2/operations/AnalyzeWithCustomForm/console but same result.

I was trying to change also form-recognizer-api-v2-1-preview-2 to "preview-3" but without success.

"AnalyzeLayout" is working fine, but I want to get data from my model.

Model works only in UI https://fott-preview.azurewebsites.net/.

0 Votes 0 ·

@Pedros-4480 Could you please post the screen shot of your analyze results response if possible? I think you might be using the request id instead of the result id from the operation location URL.

0 Votes 0 ·
Pedros-4480 avatar image
0 Votes"
Pedros-4480 answered Pedros-4480 edited

78753-image.png


@romungi-MSFT Why on the "Analyse Layout" in GET I need to pass apim-requestid (yellow) where in Custom model it works only with "Operation-Location" (red)?

Where in "Analyse Layout" both fields has the same value:
78754-image.png

Now the response from custom model (from Operation-Location) is:

{
"status": "failed",
"createdDateTime": "2021-03-17T09:56:34Z",
"lastUpdatedDateTime": "2021-03-17T09:56:38Z",
"analyzeResult": {
"version": "2.1.0",
"errors": [{
"code": "3014",
"message": "Generic error during prediction."
}]
}
}



This file is working fine in https://fott-preview.azurewebsites.net/. Sth is wrong here.


image.png (29.2 KiB)
image.png (22.9 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Pedros-4480 I am not sure why the API's are using different ids but I think it is because the layout operation is newer version and it might be designed to return the same ids in both the cases. With respect to the error for your predict operation does this occur with every call to the service and what version of the API are you using? Unfortunately, the error code is a bit generic and the actual issue for this request needs to be checked on a case basis by a service engineer based on the id.

0 Votes 0 ·

I was calling from preview 2.1, but now when I was checking, everything is working fine. Yesterday preview 3 side was not working. Now model is reading data according to training. No issue for now. Thank you for quick responses.

0 Votes 0 ·