QueryFields with Receipt Model

CB3PO 0 Reputation points
2024-07-09T17:30:11.9733333+00:00

I have been trying to make an API call to the prebuilt receipt model with queryField extraction. I have tried several combinations of the basic receipt call as well as the query fields call shown on documentation. However, nothing I have tried has worked. Does anyone know what the correct composed API call with both of these features is?

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,734 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 17,891 Reputation points
    2024-07-10T00:26:01.6+00:00

    Hello @CB3PO , Thanks for using Microsoft Q&A Platform.

    I have reproduced the same (prebuilt-receipt REST API) on my end and it worked well with no issues.

    As mentioned in the documentation you can create a Analyze document request. I have added query field label name as "QuarterlyPeriodDate".

    Here is the sample code for your reference:

    POST https://{endpoint}.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-receipt:analyze?api-version=2024-02-29-preview&features=queryFields&queryFields=QuarterlyPeriodDate
    
    Content-Type: application/json 
    Ocp-Apim-Subscription-Key:
    
     { "urlSource": "add document" }
    

    User's image

    After this you can analyze result using the request ID:

    GET https://{endpoint}.cognitiveservices.azure.com/documentintelligence/documentModels/prebuilt-receipt/analyzeResults/{requestID}?api-version=2024-02-29-preview
    
    Ocp-Apim-Subscription-Key: 
    

    User's image

    Here is the REST API documentation: https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/get-analyze-result?view=rest-aiservices-v4.0%20(2024-02-29-preview)&tabs=HTTP

    Ensure that you include the subscription key and endpoint details.

    I hope this helps.

    Regards,

    Vasavi

    -Please kindly accept the answer and vote 'yes' if you feel helpful to support the community, thanks.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.