Document Intelligence Copy model rest api several bugs

Menno Laan 0 Reputation points
2024-08-21T06:27:35.93+00:00

Hi,

referring to this:

https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/copy-model-to?view=rest-aiservices-v4.0%20(2024-07-31-preview)&tabs=HTTP

Im using 2024-07-31-preview copy and authorize api as I'm using 2AuthToAuth instead of key based access. I'm getting stuck at copy to rest api.

If I copy a model through document intelligence studio portal everything works as intended.

But when invoking the copy url with the following curl:

curl --location 'https://***.cognitiveservices.azure.com/documentintelligence/documentModels/****:copyTo?api-version=2024-07-31-preview' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ******' \
--data '{
    "targetResourceId": "/subscriptions/****/resourceGroups/***/providers/Microsoft.CognitiveServices/accounts/****",
    "targetResourceRegion": "westeurope",
    "targetModelId": "name-of-model",
    "targetModelLocation": "https://*.cognitiveservices.azure.com/documentintelligence/documentModels/name-of-model?api-version=2024-07-31-preview",
    "accessToken": "221210dc-*****",
    "expirationDateTime": "2024-08-20T15:03:13Z"
}'


It generates an error 400 bad request with the following payload:

{
    "error": {
        "code": "InvalidRequest",
        "message": "Invalid request.",
        "innererror": {
            "code": "ModelNotReady",
            "message": "Model is not ready for the requested operation. Wait for training to complete or check for operation errors."
        }
    }
}

however, doing the copy through the portal does succeed. So the model is ready.

I want to remark that if i run https://*****.cognitiveservices.azure.com/documentintelligence/documentModels?api-version=2024-07-31-preview

It doesn't show my model that is available if i look at models in Document Intelligence Studio.

Upon inspection, the model that doesn't show up has Api Version: 2024-02-29-preview and is part of a project with api version 2024-02-29-preview

But one model did show up when I ran the documentModel get request. That model displays api version 2024-02-29-preview and is part of a project with api version 2024-07-31-preview.

When I run https://*****.cognitiveservices.azure.com/documentintelligence/documentModels?api-version=2024-02-29-preview

I assumed I would finally see my model show up as I changed the api version to the api version of the project in which it was created. But it doesn't show up.

If I run https://*.cognitiveservices.azure.com/documentintelligence/docu

{
    "error": {
        "code": "InternalServerError",
        "message": "Unable to get resource information."
    }
}

So to recap:

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

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.