Share via


Custom Models - Copy

Copy custom model stored in this resource (the source) to user specified target Form Recognizer resource.

POST {endpoint}/formrecognizer/v2.1/custom/models/{modelId}/copy

URI Parameters

Name In Required Type Description
endpoint
path True

string

Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).

modelId
path True

string (uuid)

Model identifier.

Request Header

Name Required Type Description
Ocp-Apim-Subscription-Key True

string

Request Body

Name Required Type Description
copyAuthorization True

CopyAuthorizationResult

Entity that encodes claims to authorize the copy request.

targetResourceId True

string

maxLength: 1024
pattern: ^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.CognitiveServices/accounts/[^/]*$

Azure Resource Id of the target Form Recognizer resource where the model is copied to.

targetResourceRegion True

string

minLength: 1
maxLength: 24
pattern: ^[a-z0-9]+$

Location of the target Azure resource. A valid Azure region name supported by Cognitive Services.

Responses

Name Type Description
202 Accepted

Copy request is queued successfully.

Headers

Operation-Location: string

Other Status Codes

ErrorResponse

Response entity accompanying non-successful responses containing additional details about the error.

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

Examples

Copy custom model

Sample request

POST {endpoint}/formrecognizer/v2.1/custom/models/f973e3c1-1148-43bb-bea8-49d0603ab3a8/copy


{
  "targetResourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{resourceName}",
  "targetResourceRegion": "westus2",
  "copyAuthorization": {
    "modelId": "f973e3c1-1148-43bb-bea8-49d0603ab3a8",
    "accessToken": "{accessToken}",
    "expirationDateTimeTicks": 86400
  }
}

Sample response

Operation-Location: {endpoint}/formrecognizer/v2.1/custom/models/f973e3c1-1148-43bb-bea8-49d0603ab3a8/copyResults/3b1e6c5b-e113-4114-ab6b-ce65dfe8050f

Definitions

Name Description
CopyAuthorizationResult

Request parameter that contains authorization claims for copy operation.

CopyRequest

Request parameter to copy an existing custom model from the source resource to a target resource referenced by the resource ID.

ErrorInformation
ErrorResponse

CopyAuthorizationResult

Request parameter that contains authorization claims for copy operation.

Name Type Description
accessToken

string

Token claim used to authorize the request.

expirationDateTimeTicks

integer (int64)

The time when the access token expires. The date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time.

modelId

string

Model identifier.

CopyRequest

Request parameter to copy an existing custom model from the source resource to a target resource referenced by the resource ID.

Name Type Description
copyAuthorization

CopyAuthorizationResult

Entity that encodes claims to authorize the copy request.

targetResourceId

string

maxLength: 1024
pattern: ^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.CognitiveServices/accounts/[^/]*$

Azure Resource Id of the target Form Recognizer resource where the model is copied to.

targetResourceRegion

string

minLength: 1
maxLength: 24
pattern: ^[a-z0-9]+$

Location of the target Azure resource. A valid Azure region name supported by Cognitive Services.

ErrorInformation

Name Type Description
code

string

message

string

ErrorResponse

Name Type Description
error

ErrorInformation