{ "swagger": "2.0", "info": { "title": "Azure.AI.DocumentTranslation", "version": "2023-11-01-preview", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" } ] }, "schemes": [ "https" ], "x-ms-parameterized-host": { "hostTemplate": "{Endpoint}", "useSchemePrefix": false, "parameters": [ { "name": "Endpoint", "in": "path", "description": "Supported document Translation endpoints (protocol and hostname, for example: https://{TranslatorResourceName}.cognitiveservices.azure.com/translator).", "required": true, "type": "string", "format": "uri", "x-ms-skip-url-encoding": true } ] }, "produces": [ "application/json" ], "consumes": [ "application/json" ], "security": [ { "ApiKeyAuth": [] }, { "OAuth2Auth": [ "https://cognitiveservices.azure.com/.default" ] } ], "securityDefinitions": { "ApiKeyAuth": { "type": "apiKey", "name": "Ocp-Apim-Subscription-Key", "in": "header" }, "OAuth2Auth": { "type": "oauth2", "flow": "accessCode", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "scopes": { "https://cognitiveservices.azure.com/.default": "" }, "tokenUrl": "https://login.microsoftonline.com/common/oauth2/token" } }, "tags": [], "paths": { "/document:translate": { "post": { "operationId": "DocumentTranslate", "description": "API to translate a document.", "produces": [ "application/octet-stream", "application/json" ], "consumes": [ "multipart/form-data" ], "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "$ref": "#/parameters/DocumentTranslateContent.sourceLanguage" }, { "$ref": "#/parameters/DocumentTranslateContent.targetLanguage" }, { "$ref": "#/parameters/DocumentTranslateContent.category" }, { "$ref": "#/parameters/DocumentTranslateContent.allowFallback" }, { "$ref": "#/parameters/Azure.Core.ClientRequestIdHeader" }, { "$ref": "#/parameters/DocumentTranslateContent.document" }, { "$ref": "#/parameters/DocumentTranslateContent.glossary" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "type": "file" }, "headers": { "x-ms-client-request-id": { "type": "string", "format": "uuid", "description": "An opaque, globally-unique, client-generated string identifier for the request." } } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" }, "headers": { "x-ms-error-code": { "type": "string", "description": "String error code indicating what went wrong." } } } }, "x-ms-examples": { "Document Translate": { "$ref": "./examples/DocumentTranslate_MaximumSet_Gen.json" } } } } }, "definitions": { "Azure.Core.Foundations.Error": { "type": "object", "description": "The error object.", "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "message": { "type": "string", "description": "A human-readable representation of the error." }, "target": { "type": "string", "description": "The target of the error." }, "details": { "type": "array", "description": "An array of details about specific errors that led to this reported error.", "items": { "$ref": "#/definitions/Azure.Core.Foundations.Error" }, "x-ms-identifiers": [] }, "innererror": { "$ref": "#/definitions/Azure.Core.Foundations.InnerError", "description": "An object containing more specific information than the current object about the error." } }, "required": [ "code", "message" ] }, "Azure.Core.Foundations.ErrorResponse": { "type": "object", "description": "A response containing error details.", "properties": { "error": { "$ref": "#/definitions/Azure.Core.Foundations.Error", "description": "The error object." } }, "required": [ "error" ] }, "Azure.Core.Foundations.InnerError": { "type": "object", "description": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "innererror": { "$ref": "#/definitions/Azure.Core.Foundations.InnerError", "description": "Inner error." } } }, "DocumentTranslateContent": { "type": "object", "description": "Document Translate Request / Content.", "properties": { "document": { "type": "string", "format": "byte", "description": "Document to be translated in the form" }, "glossary": { "type": "array", "description": "Glossary / translation memory will be used during translation in the form.", "items": { "type": "string", "format": "byte" } } }, "required": [ "document" ] }, "DocumentTranslateResult": { "type": "object", "description": "Document Translate Result / Response.", "properties": { "document": { "type": "string", "format": "byte", "description": "Request response, response is a translated document." } }, "required": [ "document" ] }, "Versions": { "type": "string", "description": "The Azure.AI.DocumentTranslation versions.", "enum": [ "2023-11-01-preview" ], "x-ms-enum": { "name": "Versions", "modelAsString": true, "values": [ { "name": "2023-11-01-preview", "value": "2023-11-01-preview", "description": "The 2023-11-01-preview version of the Azure.AI.DocumentTranslation." } ] } } }, "parameters": { "Azure.Core.ClientRequestIdHeader": { "name": "x-ms-client-request-id", "in": "header", "description": "An opaque, globally-unique, client-generated string identifier for the request.", "required": false, "type": "string", "format": "uuid", "x-ms-parameter-location": "method", "x-ms-client-name": "clientRequestId" }, "Azure.Core.Foundations.ApiVersionParameter": { "name": "api-version", "in": "query", "description": "The API version to use for this operation.", "required": true, "type": "string", "minLength": 1, "x-ms-parameter-location": "method", "x-ms-client-name": "apiVersion" }, "DocumentTranslateContent.allowFallback": { "name": "allowFallback", "in": "query", "description": "Specifies that the service is allowed to fall back to a general system when a custom system doesn't exist. \n Possible values are: true (default) or false.", "required": false, "type": "boolean", "x-ms-parameter-location": "method" }, "DocumentTranslateContent.category": { "name": "category", "in": "query", "description": "A string specifying the category (domain) of the translation. This parameter is used to get translations \n from a customized system built with Custom Translator. Add the Category ID from your Custom Translator \n project details to this parameter to use your deployed customized system. Default value is: general.", "required": false, "type": "string", "default": "general", "x-ms-parameter-location": "method" }, "DocumentTranslateContent.document": { "name": "document", "in": "formData", "description": "Document to be translated in the form", "required": true, "type": "file", "x-ms-parameter-location": "method" }, "DocumentTranslateContent.glossary": { "name": "glossary", "in": "formData", "description": "Glossary / translation memory will be used during translation in the form.", "required": false, "type": "array", "items": { "type": "string", "format": "binary" }, "x-ms-parameter-location": "method" }, "DocumentTranslateContent.sourceLanguage": { "name": "sourceLanguage", "in": "query", "description": "Specifies source language of the input document.\nIf this parameter isn't specified, automatic language detection is applied to determine the source language.\nFor example if the source document is written in English, then use sourceLanguage=en", "required": false, "type": "string", "x-ms-parameter-location": "method" }, "DocumentTranslateContent.targetLanguage": { "name": "targetLanguage", "in": "query", "description": "Specifies the language of the output document.\nThe target language must be one of the supported languages included in the translation scope.\nFor example if you want to translate the document in German language, then use targetLanguage=de", "required": true, "type": "string", "x-ms-parameter-location": "method" } } }