Use the Content Understanding REST API
The Content Understanding REST API provides a programmatic interface that you can use to create, manage, and consume analyzers.
To use the REST API, your client application submits HTTP calls to the Content Understanding endpoint for your Azure AI services resource, passing one of the authorization keys in the header. You can obtain the endpoint and keys in the Azure portal or in the Azure AI Foundry portal. You can also use the Azure AI Foundry API to connect to the project and retrieve the endpoint and key for your Azure AI Services resource programmatically.
Using the REST API to analyze content
One of the most common uses of the REST API is to submit content to an existing analyzer that you have previously built, and retrieve the results of analysis. The analysis request returns an operation ID value that represents an asynchronous task. Your client application must then use another request to pass the operation ID back to the endpoint and retrieve the operation status - potentially polling multiple times until the operation is complete and the results are returned in JSON format.
For example, to analyze a document, a client application might submit a POST request to the analyze
function containing the following JSON body:
POST {endpoint}/contentunderstanding/analyzers/{analyzer}:analyze?api-version={api version}
{
"url": "https://host.com/doc.pdf"
}
Note
You can specify a URL for the content file location, or you can include the binary contents of the file.
Assuming the request is authenticated and initiated successfully, the response will be similar to this example:
Operation-Id: 1234abcd-1234-abcd-1234-abcd1234abcd
Operation-Location: {endpoint}/contentunderstanding/analyzers/{analyzer}/results/1234abcd-1234-abcd-1234-abcd1234abcd?api-version={api version}
{
"id": "1234abcd-1234-abcd-1234-abcd1234abcd",
"status": "NotStarted"
}
Your client application must then use the operation ID that has been returned to check the status of the operation until it has succeeded (or failed) by submitting a GET request to the results
function.
GET {endpoint}/contentunderstanding/analyzers/{analyzer}/results/1234abcd-1234-abcd-1234-abcd1234abcd?api-version={api version}
When the operation has completed successfully, the response contains a JSON payload representing the results of the analysis. The specific results depend on the content and schema.
Note
For more information about the Content Understanding REST API, see the reference documentation.