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

Sachin Tah 1 Reputation point
2021-02-05T05:14:42.897+00:00

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 AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,408 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. romungi-MSFT 42,316 Reputation points Microsoft Employee
    2021-02-05T06:45:04.363+00:00

    @Sachin Tah 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.


  2. Pedros 1 Reputation point
    2021-03-17T10:00:38.043+00:00

    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.