Skip to content

Instantly share code, notes, and snippets.

@dwsupplee
Created November 23, 2016 17:28
Show Gist options
  • Save dwsupplee/eb75e35ae96dd829387ab27e64e9aa47 to your computer and use it in GitHub Desktop.
Save dwsupplee/eb75e35ae96dd829387ab27e64e9aa47 to your computer and use it in GitHub Desktop.
Translations via POST
{
"kind": "discovery#restDescription",
"etag": "\"C5oy1hgQsABtYOYIOXWcR3BgYqU/6s__cFeA5l1i01rONlu3TmUQEHs\"",
"discoveryVersion": "v1",
"id": "translate:v2",
"name": "translate",
"version": "v2",
"revision": "20160627",
"title": "Translate API",
"description": "Translates text from one language to another.",
"ownerDomain": "google.com",
"ownerName": "Google",
"icons": {
"x16": "https://www.google.com/images/icons/product/translate-16.png",
"x32": "https://www.google.com/images/icons/product/translate-32.png"
},
"documentationLink": "https://developers.google.com/translate/v2/using_rest",
"protocol": "rest",
"baseUrl": "https://translation.googleapis.com/language/translate/",
"basePath": "/language/translate/",
"rootUrl": "https://translation.googleapis.com/",
"servicePath": "language/translate/",
"batchPath": "batch",
"parameters": {
"alt": {
"type": "string",
"description": "Data format for the response.",
"default": "json",
"enum": [
"json"
],
"enumDescriptions": [
"Responses with Content-Type of application/json"
],
"location": "query"
},
"fields": {
"type": "string",
"description": "Selector specifying which fields to include in a partial response.",
"location": "query"
},
"key": {
"type": "string",
"description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
"location": "query"
},
"oauth_token": {
"type": "string",
"description": "OAuth 2.0 token for the current user.",
"location": "query"
},
"prettyPrint": {
"type": "boolean",
"description": "Returns response with indentations and line breaks.",
"default": "true",
"location": "query"
},
"quotaUser": {
"type": "string",
"description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.",
"location": "query"
},
"userIp": {
"type": "string",
"description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.",
"location": "query"
}
},
"features": [
"dataWrapper"
],
"schemas": {
"TranslateTextRequest": {
"description": "The main translation request message for the Cloud Translation API.",
"type": "object",
"properties": {
"q": {
"description": "The input text to translate. Repeat this parameter to perform translation\noperations on multiple text inputs.",
"type": "array",
"items": {
"type": "string"
}
},
"source": {
"description": "The language of the source text, set to one of the language codes listed in\nLanguage Support. If the source language is not specified, the API will\nattempt to identify the source language automatically and return it within\nthe response.",
"type": "string"
},
"target": {
"description": "The language to use for translation of the input text, set to one of the\nlanguage codes listed in Language Support.",
"type": "string"
},
"format": {
"description": "The format of the source text, in either HTML (default) or plain-text. A\nvalue of \"html\" indicates HTML and a value of \"text\" indicates plain-text.",
"type": "string"
}
},
"id": "TranslateTextRequest"
},
"DetectionsListResponse": {
"id": "DetectionsListResponse",
"type": "object",
"properties": {
"detections": {
"type": "array",
"description": "A detections contains detection results of several text",
"items": {
"$ref": "DetectionsResource"
}
}
}
},
"DetectionsResource": {
"id": "DetectionsResource",
"type": "array",
"description": "An array of languages which we detect for the given text The most likely language list first.",
"items": {
"type": "object",
"properties": {
"confidence": {
"type": "number",
"description": "The confidence of the detection resul of this language.",
"format": "float"
},
"isReliable": {
"type": "boolean",
"description": "A boolean to indicate is the language detection result reliable."
},
"language": {
"type": "string",
"description": "The language we detect"
}
}
}
},
"LanguagesListResponse": {
"id": "LanguagesListResponse",
"type": "object",
"properties": {
"languages": {
"type": "array",
"description": "List of source/target languages supported by the translation API. If target parameter is unspecified, the list is sorted by the ASCII code point order of the language code. If target parameter is specified, the list is sorted by the collation order of the language name in the target language.",
"items": {
"$ref": "LanguagesResource"
}
}
}
},
"LanguagesResource": {
"id": "LanguagesResource",
"type": "object",
"properties": {
"language": {
"type": "string",
"description": "The language code."
},
"name": {
"type": "string",
"description": "The localized name of the language if target parameter is given."
}
}
},
"TranslationsListResponse": {
"id": "TranslationsListResponse",
"type": "object",
"properties": {
"translations": {
"type": "array",
"description": "Translations contains list of translation results of given text",
"items": {
"$ref": "TranslationsResource"
}
}
}
},
"TranslationsResource": {
"id": "TranslationsResource",
"type": "object",
"properties": {
"detectedSourceLanguage": {
"type": "string",
"description": "Detected source language if source parameter is unspecified."
},
"translatedText": {
"type": "string",
"description": "The translation."
}
}
}
},
"resources": {
"detections": {
"methods": {
"list": {
"id": "language.detections.list",
"path": "v2/detect",
"httpMethod": "GET",
"description": "Detect the language of text.",
"parameters": {
"q": {
"type": "string",
"description": "The text to detect",
"required": true,
"repeated": true,
"location": "query"
}
},
"parameterOrder": [
"q"
],
"response": {
"$ref": "DetectionsListResponse"
}
}
}
},
"languages": {
"methods": {
"list": {
"id": "language.languages.list",
"path": "v2/languages",
"httpMethod": "GET",
"description": "List the source/target languages supported by the API",
"parameters": {
"target": {
"type": "string",
"description": "the language and collation in which the localized results should be returned",
"location": "query"
}
},
"response": {
"$ref": "LanguagesListResponse"
}
}
}
},
"translations": {
"methods": {
"list": {
"id": "language.translations.list",
"path": "v2",
"httpMethod": "POST",
"description": "Returns text translations from one language to another.",
"parameters": {
"cid": {
"type": "string",
"description": "The customization id for translate",
"repeated": true,
"location": "query"
},
"model": {
"type": "string",
"description": "The model to use",
"repeated": false,
"location": "query"
}
},
"request": {
"$ref": "TranslateTextRequest"
},
"response": {
"$ref": "TranslationsListResponse"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment