Class BatchDocumentTranslationRestClient
-
Method Summary
Modifier and TypeMethodDescriptionCancel a currently processing or queued translation.Returns the status for all documents in a batch document translation request.getDocumentsStatusNext
(String nextLink) Get the next page of items.getDocumentStatus
(String id, String documentId) Returns the translation status for a specific document based on the request Id and document Id.The list of supported document formats supported by the Document Translation service.The list of supported glossary formats supported by the Document Translation service.Returns a list of storage sources/options supported by the Document Translation service.Returns a list of batch requests submitted and the status for each request.getTranslationsStatusNext
(String nextLink) Get the next page of items.Returns the status for a document translation request.invoke()
Create an empty DynamicRequest with the serializer and pipeline initialized for this client.Use this API to submit a bulk (batch) translation request to the Document Translation service.
-
Method Details
-
startTranslation
Use this API to submit a bulk (batch) translation request to the Document Translation service. Each request can contain multiple documents and must contain a source and destination container for each document.The prefix and suffix filter (if supplied) are used to filter folders. The prefix is applied to the subpath after the container name.
Glossaries / Translation memory can be included in the request and are applied by the service when the document is translated.
If the glossary is invalid or unreachable during translation, an error is indicated in the document status. If a file with the same name already exists at the destination, it will be overwritten. The targetUrl for each target language must be unique.
Request Body Schema
{ inputs: [ { source: { sourceUrl: String filter: { prefix: String suffix: String } language: String storageSource: String(AzureBlob) } targets: [ { targetUrl: String category: String language: String glossaries: [ { glossaryUrl: String format: String version: String storageSource: String(AzureBlob) } ] storageSource: String(AzureBlob) } ] storageType: String(Folder/File) } ] }
- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getTranslationsStatus
Returns a list of batch requests submitted and the status for each request. This list only contains batch requests submitted by the user (based on the resource).If the number of requests exceeds our paging limit, server-side paging is used. Paginated responses indicate a partial result and include a continuation token in the response. The absence of a continuation token means that no additional pages are available.
$top, $skip and $maxpagesize query parameters can be used to specify a number of results to return and an offset for the collection.
$top indicates the total number of records the user wants to be returned across all pages. $skip indicates the number of records to skip from the list of batches based on the sorting method specified. By default, we sort by descending start time. $maxpagesize is the maximum items returned in a page. If more items are requested via $top (or $top is not specified and there are more items to be returned), @nextLink will contain the link to the next page.
$orderBy query parameter can be used to sort the returned list (ex "$orderBy=createdDateTimeUtc asc" or "$orderBy=createdDateTimeUtc desc"). The default sorting is descending by createdDateTimeUtc. Some query parameters can be used to filter the returned list (ex: "status=Succeeded,Cancelled") will only return succeeded and cancelled operations. createdDateTimeUtcStart and createdDateTimeUtcEnd can be used combined or separately to specify a range of datetime to filter the returned list by. The supported filtering query parameters are (status, ids, createdDateTimeUtcStart, createdDateTimeUtcEnd).
The server honors the values specified by the client. However, clients must be prepared to handle responses that contain a different page size or contain a continuation token.
When both $top and $skip are included, the server should first apply $skip and then $top on the collection. Note: If the server can't honor $top and/or $skip, the server must return an error to the client informing about it instead of just ignoring the query options. This reduces the risk of the client making assumptions about the data returned.
Optional Query Parameters
Optional Query Parameters Name Type Description top Integer $top indicates the total number of records the user wants to be returned across all pages. Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection. When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection. Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options. skip Integer $skip indicates the number of records to skip from the list of records held by the server based on the sorting method specified. By default, we sort by descending start time. Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection. When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection. Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options. maxpagesize Integer $maxpagesize is the maximum items returned in a page. If more items are requested via $top (or $top is not specified and there are more items to be returned), @nextLink will contain the link to the next page. Clients MAY request server-driven paging with a specific page size by specifying a $maxpagesize preference. The server SHOULD honor this preference if the specified page size is smaller than the server's default page size. ids List<UUID> Ids to use in filtering statuses List<String> Statuses to use in filtering createdDateTimeUtcStart OffsetDateTime the start datetime to get items after createdDateTimeUtcEnd OffsetDateTime the end datetime to get items before orderBy List<String> the sorting query for the collection (ex: 'CreatedDateTimeUtc asc', 'CreatedDateTimeUtc desc') Response Body Schema
{ value: [ { id: UUID createdDateTimeUtc: OffsetDateTime lastActionDateTimeUtc: OffsetDateTime status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) error: { code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) message: String target: String innerError: { code: String message: String target: String innerError: (recursive schema, see innerError above) } } summary: { total: int failed: int success: int inProgress: int notYetStarted: int cancelled: int totalCharacterCharged: long } } ] nextLink: String }
- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getDocumentStatus
Returns the translation status for a specific document based on the request Id and document Id.Response Body Schema
{ path: String sourcePath: String createdDateTimeUtc: OffsetDateTime lastActionDateTimeUtc: OffsetDateTime status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) to: String error: { code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) message: String target: String innerError: { code: String message: String target: String innerError: (recursive schema, see innerError above) } } progress: float id: UUID characterCharged: Long }
- Parameters:
id
- Format - uuid. The batch id.documentId
- Format - uuid. The document id.- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getTranslationStatus
Returns the status for a document translation request. The status includes the overall request status, as well as the status for documents that are being translated as part of that request.Response Body Schema
{ id: UUID createdDateTimeUtc: OffsetDateTime lastActionDateTimeUtc: OffsetDateTime status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) error: { code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) message: String target: String innerError: { code: String message: String target: String innerError: (recursive schema, see innerError above) } } summary: { total: int failed: int success: int inProgress: int notYetStarted: int cancelled: int totalCharacterCharged: long } }
- Parameters:
id
- Format - uuid. The operation id.- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
cancelTranslation
Cancel a currently processing or queued translation. Cancel a currently processing or queued translation. A translation will not be cancelled if it is already completed or failed or cancelling. A bad request will be returned. All documents that have completed translation will not be cancelled and will be charged. All pending documents will be cancelled if possible.Response Body Schema
{ id: UUID createdDateTimeUtc: OffsetDateTime lastActionDateTimeUtc: OffsetDateTime status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) error: { code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) message: String target: String innerError: { code: String message: String target: String innerError: (recursive schema, see innerError above) } } summary: { total: int failed: int success: int inProgress: int notYetStarted: int cancelled: int totalCharacterCharged: long } }
- Parameters:
id
- Format - uuid. The operation-id.- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getDocumentsStatus
Returns the status for all documents in a batch document translation request.If the number of documents in the response exceeds our paging limit, server-side paging is used. Paginated responses indicate a partial result and include a continuation token in the response. The absence of a continuation token means that no additional pages are available.
$top, $skip and $maxpagesize query parameters can be used to specify a number of results to return and an offset for the collection.
$top indicates the total number of records the user wants to be returned across all pages. $skip indicates the number of records to skip from the list of document status held by the server based on the sorting method specified. By default, we sort by descending start time. $maxpagesize is the maximum items returned in a page. If more items are requested via $top (or $top is not specified and there are more items to be returned), @nextLink will contain the link to the next page.
$orderBy query parameter can be used to sort the returned list (ex "$orderBy=createdDateTimeUtc asc" or "$orderBy=createdDateTimeUtc desc"). The default sorting is descending by createdDateTimeUtc. Some query parameters can be used to filter the returned list (ex: "status=Succeeded,Cancelled") will only return succeeded and cancelled documents. createdDateTimeUtcStart and createdDateTimeUtcEnd can be used combined or separately to specify a range of datetime to filter the returned list by. The supported filtering query parameters are (status, ids, createdDateTimeUtcStart, createdDateTimeUtcEnd).
When both $top and $skip are included, the server should first apply $skip and then $top on the collection. Note: If the server can't honor $top and/or $skip, the server must return an error to the client informing about it instead of just ignoring the query options. This reduces the risk of the client making assumptions about the data returned.
Optional Query Parameters
Optional Query Parameters Name Type Description top Integer $top indicates the total number of records the user wants to be returned across all pages. Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection. When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection. Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options. skip Integer $skip indicates the number of records to skip from the list of records held by the server based on the sorting method specified. By default, we sort by descending start time. Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection. When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection. Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options. maxpagesize Integer $maxpagesize is the maximum items returned in a page. If more items are requested via $top (or $top is not specified and there are more items to be returned), @nextLink will contain the link to the next page. Clients MAY request server-driven paging with a specific page size by specifying a $maxpagesize preference. The server SHOULD honor this preference if the specified page size is smaller than the server's default page size. ids List<UUID> Ids to use in filtering statuses List<String> Statuses to use in filtering createdDateTimeUtcStart OffsetDateTime the start datetime to get items after createdDateTimeUtcEnd OffsetDateTime the end datetime to get items before orderBy List<String> the sorting query for the collection (ex: 'CreatedDateTimeUtc asc', 'CreatedDateTimeUtc desc') Response Body Schema
{ value: [ { path: String sourcePath: String createdDateTimeUtc: OffsetDateTime lastActionDateTimeUtc: OffsetDateTime status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) to: String error: { code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) message: String target: String innerError: { code: String message: String target: String innerError: (recursive schema, see innerError above) } } progress: float id: UUID characterCharged: Long } ] nextLink: String }
- Parameters:
id
- Format - uuid. The operation id.- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getSupportedDocumentFormats
The list of supported document formats supported by the Document Translation service. The list includes the common file extension, as well as the content-type if using the upload API.Response Body Schema
{ value: [ { format: String fileExtensions: [ String ] contentTypes: [ String ] defaultVersion: String versions: [ String ] } ] }
- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getSupportedGlossaryFormats
The list of supported glossary formats supported by the Document Translation service. The list includes the common file extension used.Response Body Schema
{ value: [ { format: String fileExtensions: [ String ] contentTypes: [ String ] defaultVersion: String versions: [ String ] } ] }
- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getSupportedStorageSources
Returns a list of storage sources/options supported by the Document Translation service.Response Body Schema
{ value: [ String(AzureBlob) ] }
- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getTranslationsStatusNext
Get the next page of items.Response Body Schema
{ value: [ { id: UUID createdDateTimeUtc: OffsetDateTime lastActionDateTimeUtc: OffsetDateTime status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) error: { code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) message: String target: String innerError: { code: String message: String target: String innerError: (recursive schema, see innerError above) } } summary: { total: int failed: int success: int inProgress: int notYetStarted: int cancelled: int totalCharacterCharged: long } } ] nextLink: String }
- Parameters:
nextLink
- The nextLink parameter.- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
getDocumentsStatusNext
Get the next page of items.Response Body Schema
{ value: [ { path: String sourcePath: String createdDateTimeUtc: OffsetDateTime lastActionDateTimeUtc: OffsetDateTime status: String(NotStarted/Running/Succeeded/Failed/Cancelled/Cancelling/ValidationFailed) to: String error: { code: String(InvalidRequest/InvalidArgument/InternalServerError/ServiceUnavailable/ResourceNotFound/Unauthorized/RequestRateTooHigh) message: String target: String innerError: { code: String message: String target: String innerError: (recursive schema, see innerError above) } } progress: float id: UUID characterCharged: Long } ] nextLink: String }
- Parameters:
nextLink
- The nextLink parameter.- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-
invoke
Create an empty DynamicRequest with the serializer and pipeline initialized for this client.- Returns:
- a DynamicRequest where customizations can be made before sent to the service.
-