translation APIv1.0.0 (experimental)

translate

POST
/translate
Translates input text into the specified language.

Input

Resource URI (production)

POST https://apid.ebay.com/commerce/translation/v1/translate

URI parameters

HTTP request headers

All requests made to eBay REST operations require you to provide the Authorization HTTP header for authentication authorization.

OAuth scope

This request requires an access token created with the client credentials grant flow, using one or more scopes from the following list (please check your Application Keys page for a list of OAuth scopes available to your application):

https://api.ebay.com/oauth/api_scope

See OAuth access tokens for more information.

Input container/fieldTypeDescription
fromLanguageEnumThe language of the input text to be translated. For the initial release, from must be set to "en" (English) for titles and descriptions and "zh" (Mandarin Chinese) for queries.

Applicable values: en, zh

Occurrence: Required

toLanguageEnumThe target language for the translation of the input text. For the initial release, to must be set to "zh" (Mandarin Chinese) for titles and descriptions and "en" (English) for queries.

Applicable values: en, zh

Occurrence: Required

translationContextTranslationContextEnumThe context of the translation. The context determines the rules that apply for the translation. For example, the allowed number of strings that can be submitted for titles differs from the number of strings that can be submitted for descriptions.

Applicable values: ITEM_TITLE, ITEM_DESCRIPTION, ITEM_QUERY

Occurrence: Required

textarray of stringThe input text to translate.

Note: Do not include markup (e.g., HTML links or JavaScript). All markup will be removed during translation.

Max string length: 80 characters (for titles and queries), 2,000 characters (descriptions)

Max occurrence: 8 input strings for titles and queries, 1 input string for descriptions

Occurrence: Required

Output

HTTP response headers

Output container/fieldTypeDescription
translationsarray of TranslationThe list of translations.

Occurrence: Conditional

translations.fromLanguageEnumThe language of the input text.

Occurrence: Conditional

translations.toLanguageEnumThe language to use for the translation of th einput text.

Occurrence: Conditional

translations.originalTextstringOriginal text.

Occurrence: Conditional

translations.translatedTextstringTranslated text.

Occurrence: Conditional

HTTP status codes

This call can return one of the following HTTP status codes. For an overview of the status codes, see HTTP status codes in Using eBay RESTful APIs.

StatusMeaning
200OK
400Bad Request
500Internal Server Error

Error codes

For more on errors, plus the codes of other common errors, see Handling errors.

CodeDomainCategoryMeaning
110000API_TRANSLATIONAPPLICATIONThere was a problem with an eBay internal system or process. Contact eBay developer support for assistance.
110001API_TRANSLATIONREQUESTFrom language is not supported. For more information, see the API call reference documentation.
110002API_TRANSLATIONREQUESTTo language is not supported. For more information, see the API call reference documentation.
110003API_TRANSLATIONREQUESTContext is not supported. For more information, see the API call reference documentation.
110004API_TRANSLATIONREQUESTMaximum number of input text reached. For more information, see the API call reference documentation.
110005API_TRANSLATIONREQUESTMaximum length of input text reached. For more information, see the API call reference documentation.
110006API_TRANSLATIONREQUESTTo and from languages cannot be the same.

Samples

New to making API calls? Please see Making a Call.

Note: Identifiers, such as order IDs or user IDs, and personal data in these samples might be anonymized or may no longer be active on eBay. If necessary, substitute current, relevant eBay data in your requests.

Sample 1: Translate an Item Title

Translate a title of an item listing from English to Chinese (Mandarin).

Input

The inputs are text (comma-separated array of strings to translate), translationContext (the translation rules to apply), from (the language of the source text), and to, (the language into which the text will be translated).
POST
https://apid.ebay.com/commerce/translation/v1/translate

Output

Upon success, the response includes a separate translation object for each string that was translated, including the original text, the source and target languages, and the translated text.

Sample 2: Translate an Item Description

Translate a description of an item from English to Chinese (Mandarin).

Input

The input fields for translating an item description are the same as those used for translating a title, but the translationContext sets the rules to apply to the translation (e.g., just one string, max string length is 2,000 characters, etc.).
POST
https://apid.ebay.com/commerce/translation/v1/translate

Output

Upon success, the response returns the translated item description.

Sample 3: Translate a buyer query into the commerce site language

Translates a Chinese query string from the foreign buyer in into English for use on the commerce site from which inventory is being surfaced.

Input

The input fields for translating a query are the same as those used for translating a title or description, but the to and from values are reversed. This lets you get a query from the foreign buyer translated into the language of the given marketplace or commerce site.
POST
https://apid.ebay.com/commerce/translation/v1/translate

Output

Upon success, the response includes an array of translated queries.