question

wrappingduke-9129 avatar image
0 Votes"
wrappingduke-9129 asked YutongTie-MSFT commented

202 status from Cognitive services

I'm attempting to analyze forms (i.e. receipts) using Azure's Cognitive Services but having some trouble. When a call is made to the service to retrieve the Operation ID, a http status of 202 or Accepted is returned from service.


Help is appreciated.

azure-cognitive-services
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.

1 Answer

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

Hello,

Thanks for reaching out to us. A 202 response is not an error code, instead it means that your first POST API call was successful. The next step would be to make a GET call using the Operation-Location from your response and the same subscription key you used before.

The service has accepted the request and will start processing soon. The client can query the operation status and result using the URL specified in the 'Operation-Location' response header. The URL expires in 48 hours.

Operation-Location URL containing the resultId used to track the progress and obtain the result of the analyze operation.
Example: https://cognitiveservice/formrecognizer/v2.0-preview/custom/models/{modelId}/analyzeResults/{resultId}


Regards,
Yutong

· 4
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.

Hi,

Thanks for the reply. It's appreciated. A status of 200 or "Success" is never received and so, the Operation Id isn't provided to make a subsequent GET call. Each POST call seems to be in a holding pattern as indicated by the 202 status. Lastly, the Activity Log is empty for the Azure resource.

0 Votes 0 ·

Hello,

I just do a quick demo for you. The request ID is in header part as below. Please check on your header value as well.


96123-image.png


Regards,
Yutong


0 Votes 0 ·
image.png (56.8 KiB)

Hi Yutong,

Thanks. That did it. The "Quickstart: Form Recognizer" (https://docs.microsoft.com/en-us/azure/cognitive-services/form-recognizer/quickstarts/client-library), clearly states that the 202 response includes the Operation or Request information in the response header. My apologies.

0 Votes 0 ·
Show more comments