Cloud Translation API
POST
translate.projects.locations.batchTranslateDocument
{{baseUrl}}/v3beta1/:parent:batchTranslateDocument
QUERY PARAMS
parent
BODY json
{
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": {},
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
}
}
],
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument" {:content-type :json
:form-params {:customizedAttribution ""
:enableShadowRemovalNativePdf false
:formatConversions {}
:glossaries {}
:inputConfigs [{:gcsSource {:inputUri ""}}]
:models {}
:outputConfig {:gcsDestination {:outputUriPrefix ""}}
:sourceLanguageCode ""
:targetLanguageCodes []}})
require "http/client"
url = "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:parent:batchTranslateDocument"),
Content = new StringContent("{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:parent:batchTranslateDocument");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument"
payload := strings.NewReader("{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v3beta1/:parent:batchTranslateDocument HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 366
{
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": {},
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
}
}
],
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument")
.setHeader("content-type", "application/json")
.setBody("{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:parent:batchTranslateDocument"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:batchTranslateDocument")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v3beta1/:parent:batchTranslateDocument")
.header("content-type", "application/json")
.body("{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
.asString();
const data = JSON.stringify({
customizedAttribution: '',
enableShadowRemovalNativePdf: false,
formatConversions: {},
glossaries: {},
inputConfigs: [
{
gcsSource: {
inputUri: ''
}
}
],
models: {},
outputConfig: {
gcsDestination: {
outputUriPrefix: ''
}
},
sourceLanguageCode: '',
targetLanguageCodes: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument',
headers: {'content-type': 'application/json'},
data: {
customizedAttribution: '',
enableShadowRemovalNativePdf: false,
formatConversions: {},
glossaries: {},
inputConfigs: [{gcsSource: {inputUri: ''}}],
models: {},
outputConfig: {gcsDestination: {outputUriPrefix: ''}},
sourceLanguageCode: '',
targetLanguageCodes: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customizedAttribution":"","enableShadowRemovalNativePdf":false,"formatConversions":{},"glossaries":{},"inputConfigs":[{"gcsSource":{"inputUri":""}}],"models":{},"outputConfig":{"gcsDestination":{"outputUriPrefix":""}},"sourceLanguageCode":"","targetLanguageCodes":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "customizedAttribution": "",\n "enableShadowRemovalNativePdf": false,\n "formatConversions": {},\n "glossaries": {},\n "inputConfigs": [\n {\n "gcsSource": {\n "inputUri": ""\n }\n }\n ],\n "models": {},\n "outputConfig": {\n "gcsDestination": {\n "outputUriPrefix": ""\n }\n },\n "sourceLanguageCode": "",\n "targetLanguageCodes": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:batchTranslateDocument")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:parent:batchTranslateDocument',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
customizedAttribution: '',
enableShadowRemovalNativePdf: false,
formatConversions: {},
glossaries: {},
inputConfigs: [{gcsSource: {inputUri: ''}}],
models: {},
outputConfig: {gcsDestination: {outputUriPrefix: ''}},
sourceLanguageCode: '',
targetLanguageCodes: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument',
headers: {'content-type': 'application/json'},
body: {
customizedAttribution: '',
enableShadowRemovalNativePdf: false,
formatConversions: {},
glossaries: {},
inputConfigs: [{gcsSource: {inputUri: ''}}],
models: {},
outputConfig: {gcsDestination: {outputUriPrefix: ''}},
sourceLanguageCode: '',
targetLanguageCodes: []
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
customizedAttribution: '',
enableShadowRemovalNativePdf: false,
formatConversions: {},
glossaries: {},
inputConfigs: [
{
gcsSource: {
inputUri: ''
}
}
],
models: {},
outputConfig: {
gcsDestination: {
outputUriPrefix: ''
}
},
sourceLanguageCode: '',
targetLanguageCodes: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument',
headers: {'content-type': 'application/json'},
data: {
customizedAttribution: '',
enableShadowRemovalNativePdf: false,
formatConversions: {},
glossaries: {},
inputConfigs: [{gcsSource: {inputUri: ''}}],
models: {},
outputConfig: {gcsDestination: {outputUriPrefix: ''}},
sourceLanguageCode: '',
targetLanguageCodes: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customizedAttribution":"","enableShadowRemovalNativePdf":false,"formatConversions":{},"glossaries":{},"inputConfigs":[{"gcsSource":{"inputUri":""}}],"models":{},"outputConfig":{"gcsDestination":{"outputUriPrefix":""}},"sourceLanguageCode":"","targetLanguageCodes":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"customizedAttribution": @"",
@"enableShadowRemovalNativePdf": @NO,
@"formatConversions": @{ },
@"glossaries": @{ },
@"inputConfigs": @[ @{ @"gcsSource": @{ @"inputUri": @"" } } ],
@"models": @{ },
@"outputConfig": @{ @"gcsDestination": @{ @"outputUriPrefix": @"" } },
@"sourceLanguageCode": @"",
@"targetLanguageCodes": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:parent:batchTranslateDocument"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:parent:batchTranslateDocument",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customizedAttribution' => '',
'enableShadowRemovalNativePdf' => null,
'formatConversions' => [
],
'glossaries' => [
],
'inputConfigs' => [
[
'gcsSource' => [
'inputUri' => ''
]
]
],
'models' => [
],
'outputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
]
],
'sourceLanguageCode' => '',
'targetLanguageCodes' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument', [
'body' => '{
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": {},
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
}
}
],
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:parent:batchTranslateDocument');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'customizedAttribution' => '',
'enableShadowRemovalNativePdf' => null,
'formatConversions' => [
],
'glossaries' => [
],
'inputConfigs' => [
[
'gcsSource' => [
'inputUri' => ''
]
]
],
'models' => [
],
'outputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
]
],
'sourceLanguageCode' => '',
'targetLanguageCodes' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'customizedAttribution' => '',
'enableShadowRemovalNativePdf' => null,
'formatConversions' => [
],
'glossaries' => [
],
'inputConfigs' => [
[
'gcsSource' => [
'inputUri' => ''
]
]
],
'models' => [
],
'outputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
]
],
'sourceLanguageCode' => '',
'targetLanguageCodes' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v3beta1/:parent:batchTranslateDocument');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": {},
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
}
}
],
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:parent:batchTranslateDocument' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": {},
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
}
}
],
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v3beta1/:parent:batchTranslateDocument", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument"
payload = {
"customizedAttribution": "",
"enableShadowRemovalNativePdf": False,
"formatConversions": {},
"glossaries": {},
"inputConfigs": [{ "gcsSource": { "inputUri": "" } }],
"models": {},
"outputConfig": { "gcsDestination": { "outputUriPrefix": "" } },
"sourceLanguageCode": "",
"targetLanguageCodes": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument"
payload <- "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:parent:batchTranslateDocument")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v3beta1/:parent:batchTranslateDocument') do |req|
req.body = "{\n \"customizedAttribution\": \"\",\n \"enableShadowRemovalNativePdf\": false,\n \"formatConversions\": {},\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n }\n ],\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument";
let payload = json!({
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": json!({}),
"glossaries": json!({}),
"inputConfigs": (json!({"gcsSource": json!({"inputUri": ""})})),
"models": json!({}),
"outputConfig": json!({"gcsDestination": json!({"outputUriPrefix": ""})}),
"sourceLanguageCode": "",
"targetLanguageCodes": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v3beta1/:parent:batchTranslateDocument \
--header 'content-type: application/json' \
--data '{
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": {},
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
}
}
],
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}'
echo '{
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": {},
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
}
}
],
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}' | \
http POST {{baseUrl}}/v3beta1/:parent:batchTranslateDocument \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "customizedAttribution": "",\n "enableShadowRemovalNativePdf": false,\n "formatConversions": {},\n "glossaries": {},\n "inputConfigs": [\n {\n "gcsSource": {\n "inputUri": ""\n }\n }\n ],\n "models": {},\n "outputConfig": {\n "gcsDestination": {\n "outputUriPrefix": ""\n }\n },\n "sourceLanguageCode": "",\n "targetLanguageCodes": []\n}' \
--output-document \
- {{baseUrl}}/v3beta1/:parent:batchTranslateDocument
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"customizedAttribution": "",
"enableShadowRemovalNativePdf": false,
"formatConversions": [],
"glossaries": [],
"inputConfigs": [["gcsSource": ["inputUri": ""]]],
"models": [],
"outputConfig": ["gcsDestination": ["outputUriPrefix": ""]],
"sourceLanguageCode": "",
"targetLanguageCodes": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:parent:batchTranslateDocument")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
translate.projects.locations.batchTranslateText
{{baseUrl}}/v3beta1/:parent:batchTranslateText
QUERY PARAMS
parent
BODY json
{
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
}
],
"labels": {},
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:parent:batchTranslateText");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v3beta1/:parent:batchTranslateText" {:content-type :json
:form-params {:glossaries {}
:inputConfigs [{:gcsSource {:inputUri ""}
:mimeType ""}]
:labels {}
:models {}
:outputConfig {:gcsDestination {:outputUriPrefix ""}}
:sourceLanguageCode ""
:targetLanguageCodes []}})
require "http/client"
url = "{{baseUrl}}/v3beta1/:parent:batchTranslateText"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:parent:batchTranslateText"),
Content = new StringContent("{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:parent:batchTranslateText");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:parent:batchTranslateText"
payload := strings.NewReader("{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v3beta1/:parent:batchTranslateText HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 305
{
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
}
],
"labels": {},
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v3beta1/:parent:batchTranslateText")
.setHeader("content-type", "application/json")
.setBody("{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:parent:batchTranslateText"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:batchTranslateText")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v3beta1/:parent:batchTranslateText")
.header("content-type", "application/json")
.body("{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
.asString();
const data = JSON.stringify({
glossaries: {},
inputConfigs: [
{
gcsSource: {
inputUri: ''
},
mimeType: ''
}
],
labels: {},
models: {},
outputConfig: {
gcsDestination: {
outputUriPrefix: ''
}
},
sourceLanguageCode: '',
targetLanguageCodes: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v3beta1/:parent:batchTranslateText');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:batchTranslateText',
headers: {'content-type': 'application/json'},
data: {
glossaries: {},
inputConfigs: [{gcsSource: {inputUri: ''}, mimeType: ''}],
labels: {},
models: {},
outputConfig: {gcsDestination: {outputUriPrefix: ''}},
sourceLanguageCode: '',
targetLanguageCodes: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:parent:batchTranslateText';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"glossaries":{},"inputConfigs":[{"gcsSource":{"inputUri":""},"mimeType":""}],"labels":{},"models":{},"outputConfig":{"gcsDestination":{"outputUriPrefix":""}},"sourceLanguageCode":"","targetLanguageCodes":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:parent:batchTranslateText',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "glossaries": {},\n "inputConfigs": [\n {\n "gcsSource": {\n "inputUri": ""\n },\n "mimeType": ""\n }\n ],\n "labels": {},\n "models": {},\n "outputConfig": {\n "gcsDestination": {\n "outputUriPrefix": ""\n }\n },\n "sourceLanguageCode": "",\n "targetLanguageCodes": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:batchTranslateText")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:parent:batchTranslateText',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
glossaries: {},
inputConfigs: [{gcsSource: {inputUri: ''}, mimeType: ''}],
labels: {},
models: {},
outputConfig: {gcsDestination: {outputUriPrefix: ''}},
sourceLanguageCode: '',
targetLanguageCodes: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:batchTranslateText',
headers: {'content-type': 'application/json'},
body: {
glossaries: {},
inputConfigs: [{gcsSource: {inputUri: ''}, mimeType: ''}],
labels: {},
models: {},
outputConfig: {gcsDestination: {outputUriPrefix: ''}},
sourceLanguageCode: '',
targetLanguageCodes: []
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v3beta1/:parent:batchTranslateText');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
glossaries: {},
inputConfigs: [
{
gcsSource: {
inputUri: ''
},
mimeType: ''
}
],
labels: {},
models: {},
outputConfig: {
gcsDestination: {
outputUriPrefix: ''
}
},
sourceLanguageCode: '',
targetLanguageCodes: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:batchTranslateText',
headers: {'content-type': 'application/json'},
data: {
glossaries: {},
inputConfigs: [{gcsSource: {inputUri: ''}, mimeType: ''}],
labels: {},
models: {},
outputConfig: {gcsDestination: {outputUriPrefix: ''}},
sourceLanguageCode: '',
targetLanguageCodes: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:parent:batchTranslateText';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"glossaries":{},"inputConfigs":[{"gcsSource":{"inputUri":""},"mimeType":""}],"labels":{},"models":{},"outputConfig":{"gcsDestination":{"outputUriPrefix":""}},"sourceLanguageCode":"","targetLanguageCodes":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"glossaries": @{ },
@"inputConfigs": @[ @{ @"gcsSource": @{ @"inputUri": @"" }, @"mimeType": @"" } ],
@"labels": @{ },
@"models": @{ },
@"outputConfig": @{ @"gcsDestination": @{ @"outputUriPrefix": @"" } },
@"sourceLanguageCode": @"",
@"targetLanguageCodes": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:parent:batchTranslateText"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:parent:batchTranslateText" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:parent:batchTranslateText",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'glossaries' => [
],
'inputConfigs' => [
[
'gcsSource' => [
'inputUri' => ''
],
'mimeType' => ''
]
],
'labels' => [
],
'models' => [
],
'outputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
]
],
'sourceLanguageCode' => '',
'targetLanguageCodes' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v3beta1/:parent:batchTranslateText', [
'body' => '{
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
}
],
"labels": {},
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:parent:batchTranslateText');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'glossaries' => [
],
'inputConfigs' => [
[
'gcsSource' => [
'inputUri' => ''
],
'mimeType' => ''
]
],
'labels' => [
],
'models' => [
],
'outputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
]
],
'sourceLanguageCode' => '',
'targetLanguageCodes' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'glossaries' => [
],
'inputConfigs' => [
[
'gcsSource' => [
'inputUri' => ''
],
'mimeType' => ''
]
],
'labels' => [
],
'models' => [
],
'outputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
]
],
'sourceLanguageCode' => '',
'targetLanguageCodes' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/v3beta1/:parent:batchTranslateText');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:parent:batchTranslateText' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
}
],
"labels": {},
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:parent:batchTranslateText' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
}
],
"labels": {},
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v3beta1/:parent:batchTranslateText", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:parent:batchTranslateText"
payload = {
"glossaries": {},
"inputConfigs": [
{
"gcsSource": { "inputUri": "" },
"mimeType": ""
}
],
"labels": {},
"models": {},
"outputConfig": { "gcsDestination": { "outputUriPrefix": "" } },
"sourceLanguageCode": "",
"targetLanguageCodes": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:parent:batchTranslateText"
payload <- "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:parent:batchTranslateText")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v3beta1/:parent:batchTranslateText') do |req|
req.body = "{\n \"glossaries\": {},\n \"inputConfigs\": [\n {\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n }\n ],\n \"labels\": {},\n \"models\": {},\n \"outputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n }\n },\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCodes\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:parent:batchTranslateText";
let payload = json!({
"glossaries": json!({}),
"inputConfigs": (
json!({
"gcsSource": json!({"inputUri": ""}),
"mimeType": ""
})
),
"labels": json!({}),
"models": json!({}),
"outputConfig": json!({"gcsDestination": json!({"outputUriPrefix": ""})}),
"sourceLanguageCode": "",
"targetLanguageCodes": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v3beta1/:parent:batchTranslateText \
--header 'content-type: application/json' \
--data '{
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
}
],
"labels": {},
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}'
echo '{
"glossaries": {},
"inputConfigs": [
{
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
}
],
"labels": {},
"models": {},
"outputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
}
},
"sourceLanguageCode": "",
"targetLanguageCodes": []
}' | \
http POST {{baseUrl}}/v3beta1/:parent:batchTranslateText \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "glossaries": {},\n "inputConfigs": [\n {\n "gcsSource": {\n "inputUri": ""\n },\n "mimeType": ""\n }\n ],\n "labels": {},\n "models": {},\n "outputConfig": {\n "gcsDestination": {\n "outputUriPrefix": ""\n }\n },\n "sourceLanguageCode": "",\n "targetLanguageCodes": []\n}' \
--output-document \
- {{baseUrl}}/v3beta1/:parent:batchTranslateText
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"glossaries": [],
"inputConfigs": [
[
"gcsSource": ["inputUri": ""],
"mimeType": ""
]
],
"labels": [],
"models": [],
"outputConfig": ["gcsDestination": ["outputUriPrefix": ""]],
"sourceLanguageCode": "",
"targetLanguageCodes": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:parent:batchTranslateText")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
translate.projects.locations.detectLanguage
{{baseUrl}}/v3beta1/:parent:detectLanguage
QUERY PARAMS
parent
BODY json
{
"content": "",
"labels": {},
"mimeType": "",
"model": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:parent:detectLanguage");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v3beta1/:parent:detectLanguage" {:content-type :json
:form-params {:content ""
:labels {}
:mimeType ""
:model ""}})
require "http/client"
url = "{{baseUrl}}/v3beta1/:parent:detectLanguage"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:parent:detectLanguage"),
Content = new StringContent("{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:parent:detectLanguage");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:parent:detectLanguage"
payload := strings.NewReader("{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v3beta1/:parent:detectLanguage HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 68
{
"content": "",
"labels": {},
"mimeType": "",
"model": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v3beta1/:parent:detectLanguage")
.setHeader("content-type", "application/json")
.setBody("{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:parent:detectLanguage"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:detectLanguage")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v3beta1/:parent:detectLanguage")
.header("content-type", "application/json")
.body("{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}")
.asString();
const data = JSON.stringify({
content: '',
labels: {},
mimeType: '',
model: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v3beta1/:parent:detectLanguage');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:detectLanguage',
headers: {'content-type': 'application/json'},
data: {content: '', labels: {}, mimeType: '', model: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:parent:detectLanguage';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"content":"","labels":{},"mimeType":"","model":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:parent:detectLanguage',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "content": "",\n "labels": {},\n "mimeType": "",\n "model": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:detectLanguage")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:parent:detectLanguage',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({content: '', labels: {}, mimeType: '', model: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:detectLanguage',
headers: {'content-type': 'application/json'},
body: {content: '', labels: {}, mimeType: '', model: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v3beta1/:parent:detectLanguage');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
content: '',
labels: {},
mimeType: '',
model: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:detectLanguage',
headers: {'content-type': 'application/json'},
data: {content: '', labels: {}, mimeType: '', model: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:parent:detectLanguage';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"content":"","labels":{},"mimeType":"","model":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"content": @"",
@"labels": @{ },
@"mimeType": @"",
@"model": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:parent:detectLanguage"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:parent:detectLanguage" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:parent:detectLanguage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'content' => '',
'labels' => [
],
'mimeType' => '',
'model' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v3beta1/:parent:detectLanguage', [
'body' => '{
"content": "",
"labels": {},
"mimeType": "",
"model": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:parent:detectLanguage');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'content' => '',
'labels' => [
],
'mimeType' => '',
'model' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'content' => '',
'labels' => [
],
'mimeType' => '',
'model' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v3beta1/:parent:detectLanguage');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:parent:detectLanguage' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"content": "",
"labels": {},
"mimeType": "",
"model": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:parent:detectLanguage' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"content": "",
"labels": {},
"mimeType": "",
"model": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v3beta1/:parent:detectLanguage", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:parent:detectLanguage"
payload = {
"content": "",
"labels": {},
"mimeType": "",
"model": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:parent:detectLanguage"
payload <- "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:parent:detectLanguage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v3beta1/:parent:detectLanguage') do |req|
req.body = "{\n \"content\": \"\",\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:parent:detectLanguage";
let payload = json!({
"content": "",
"labels": json!({}),
"mimeType": "",
"model": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v3beta1/:parent:detectLanguage \
--header 'content-type: application/json' \
--data '{
"content": "",
"labels": {},
"mimeType": "",
"model": ""
}'
echo '{
"content": "",
"labels": {},
"mimeType": "",
"model": ""
}' | \
http POST {{baseUrl}}/v3beta1/:parent:detectLanguage \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "content": "",\n "labels": {},\n "mimeType": "",\n "model": ""\n}' \
--output-document \
- {{baseUrl}}/v3beta1/:parent:detectLanguage
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"content": "",
"labels": [],
"mimeType": "",
"model": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:parent:detectLanguage")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
translate.projects.locations.getSupportedLanguages
{{baseUrl}}/v3beta1/:parent/supportedLanguages
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:parent/supportedLanguages");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v3beta1/:parent/supportedLanguages")
require "http/client"
url = "{{baseUrl}}/v3beta1/:parent/supportedLanguages"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:parent/supportedLanguages"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:parent/supportedLanguages");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:parent/supportedLanguages"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v3beta1/:parent/supportedLanguages HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v3beta1/:parent/supportedLanguages")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:parent/supportedLanguages"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent/supportedLanguages")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v3beta1/:parent/supportedLanguages")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v3beta1/:parent/supportedLanguages');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/v3beta1/:parent/supportedLanguages'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:parent/supportedLanguages';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:parent/supportedLanguages',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent/supportedLanguages")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:parent/supportedLanguages',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/v3beta1/:parent/supportedLanguages'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v3beta1/:parent/supportedLanguages');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/v3beta1/:parent/supportedLanguages'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:parent/supportedLanguages';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:parent/supportedLanguages"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:parent/supportedLanguages" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:parent/supportedLanguages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v3beta1/:parent/supportedLanguages');
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:parent/supportedLanguages');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v3beta1/:parent/supportedLanguages');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:parent/supportedLanguages' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:parent/supportedLanguages' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v3beta1/:parent/supportedLanguages")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:parent/supportedLanguages"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:parent/supportedLanguages"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:parent/supportedLanguages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v3beta1/:parent/supportedLanguages') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:parent/supportedLanguages";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v3beta1/:parent/supportedLanguages
http GET {{baseUrl}}/v3beta1/:parent/supportedLanguages
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v3beta1/:parent/supportedLanguages
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:parent/supportedLanguages")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
translate.projects.locations.glossaries.create
{{baseUrl}}/v3beta1/:parent/glossaries
QUERY PARAMS
parent
BODY json
{
"endTime": "",
"entryCount": 0,
"inputConfig": {
"gcsSource": {
"inputUri": ""
}
},
"languageCodesSet": {
"languageCodes": []
},
"languagePair": {
"sourceLanguageCode": "",
"targetLanguageCode": ""
},
"name": "",
"submitTime": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:parent/glossaries");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v3beta1/:parent/glossaries" {:content-type :json
:form-params {:endTime ""
:entryCount 0
:inputConfig {:gcsSource {:inputUri ""}}
:languageCodesSet {:languageCodes []}
:languagePair {:sourceLanguageCode ""
:targetLanguageCode ""}
:name ""
:submitTime ""}})
require "http/client"
url = "{{baseUrl}}/v3beta1/:parent/glossaries"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:parent/glossaries"),
Content = new StringContent("{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:parent/glossaries");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:parent/glossaries"
payload := strings.NewReader("{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v3beta1/:parent/glossaries HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 279
{
"endTime": "",
"entryCount": 0,
"inputConfig": {
"gcsSource": {
"inputUri": ""
}
},
"languageCodesSet": {
"languageCodes": []
},
"languagePair": {
"sourceLanguageCode": "",
"targetLanguageCode": ""
},
"name": "",
"submitTime": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v3beta1/:parent/glossaries")
.setHeader("content-type", "application/json")
.setBody("{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:parent/glossaries"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent/glossaries")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v3beta1/:parent/glossaries")
.header("content-type", "application/json")
.body("{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}")
.asString();
const data = JSON.stringify({
endTime: '',
entryCount: 0,
inputConfig: {
gcsSource: {
inputUri: ''
}
},
languageCodesSet: {
languageCodes: []
},
languagePair: {
sourceLanguageCode: '',
targetLanguageCode: ''
},
name: '',
submitTime: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v3beta1/:parent/glossaries');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent/glossaries',
headers: {'content-type': 'application/json'},
data: {
endTime: '',
entryCount: 0,
inputConfig: {gcsSource: {inputUri: ''}},
languageCodesSet: {languageCodes: []},
languagePair: {sourceLanguageCode: '', targetLanguageCode: ''},
name: '',
submitTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:parent/glossaries';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"endTime":"","entryCount":0,"inputConfig":{"gcsSource":{"inputUri":""}},"languageCodesSet":{"languageCodes":[]},"languagePair":{"sourceLanguageCode":"","targetLanguageCode":""},"name":"","submitTime":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:parent/glossaries',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "endTime": "",\n "entryCount": 0,\n "inputConfig": {\n "gcsSource": {\n "inputUri": ""\n }\n },\n "languageCodesSet": {\n "languageCodes": []\n },\n "languagePair": {\n "sourceLanguageCode": "",\n "targetLanguageCode": ""\n },\n "name": "",\n "submitTime": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent/glossaries")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:parent/glossaries',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
endTime: '',
entryCount: 0,
inputConfig: {gcsSource: {inputUri: ''}},
languageCodesSet: {languageCodes: []},
languagePair: {sourceLanguageCode: '', targetLanguageCode: ''},
name: '',
submitTime: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent/glossaries',
headers: {'content-type': 'application/json'},
body: {
endTime: '',
entryCount: 0,
inputConfig: {gcsSource: {inputUri: ''}},
languageCodesSet: {languageCodes: []},
languagePair: {sourceLanguageCode: '', targetLanguageCode: ''},
name: '',
submitTime: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v3beta1/:parent/glossaries');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
endTime: '',
entryCount: 0,
inputConfig: {
gcsSource: {
inputUri: ''
}
},
languageCodesSet: {
languageCodes: []
},
languagePair: {
sourceLanguageCode: '',
targetLanguageCode: ''
},
name: '',
submitTime: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent/glossaries',
headers: {'content-type': 'application/json'},
data: {
endTime: '',
entryCount: 0,
inputConfig: {gcsSource: {inputUri: ''}},
languageCodesSet: {languageCodes: []},
languagePair: {sourceLanguageCode: '', targetLanguageCode: ''},
name: '',
submitTime: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:parent/glossaries';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"endTime":"","entryCount":0,"inputConfig":{"gcsSource":{"inputUri":""}},"languageCodesSet":{"languageCodes":[]},"languagePair":{"sourceLanguageCode":"","targetLanguageCode":""},"name":"","submitTime":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"endTime": @"",
@"entryCount": @0,
@"inputConfig": @{ @"gcsSource": @{ @"inputUri": @"" } },
@"languageCodesSet": @{ @"languageCodes": @[ ] },
@"languagePair": @{ @"sourceLanguageCode": @"", @"targetLanguageCode": @"" },
@"name": @"",
@"submitTime": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:parent/glossaries"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:parent/glossaries" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:parent/glossaries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'endTime' => '',
'entryCount' => 0,
'inputConfig' => [
'gcsSource' => [
'inputUri' => ''
]
],
'languageCodesSet' => [
'languageCodes' => [
]
],
'languagePair' => [
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
],
'name' => '',
'submitTime' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v3beta1/:parent/glossaries', [
'body' => '{
"endTime": "",
"entryCount": 0,
"inputConfig": {
"gcsSource": {
"inputUri": ""
}
},
"languageCodesSet": {
"languageCodes": []
},
"languagePair": {
"sourceLanguageCode": "",
"targetLanguageCode": ""
},
"name": "",
"submitTime": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:parent/glossaries');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'endTime' => '',
'entryCount' => 0,
'inputConfig' => [
'gcsSource' => [
'inputUri' => ''
]
],
'languageCodesSet' => [
'languageCodes' => [
]
],
'languagePair' => [
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
],
'name' => '',
'submitTime' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'endTime' => '',
'entryCount' => 0,
'inputConfig' => [
'gcsSource' => [
'inputUri' => ''
]
],
'languageCodesSet' => [
'languageCodes' => [
]
],
'languagePair' => [
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
],
'name' => '',
'submitTime' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v3beta1/:parent/glossaries');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:parent/glossaries' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"endTime": "",
"entryCount": 0,
"inputConfig": {
"gcsSource": {
"inputUri": ""
}
},
"languageCodesSet": {
"languageCodes": []
},
"languagePair": {
"sourceLanguageCode": "",
"targetLanguageCode": ""
},
"name": "",
"submitTime": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:parent/glossaries' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"endTime": "",
"entryCount": 0,
"inputConfig": {
"gcsSource": {
"inputUri": ""
}
},
"languageCodesSet": {
"languageCodes": []
},
"languagePair": {
"sourceLanguageCode": "",
"targetLanguageCode": ""
},
"name": "",
"submitTime": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v3beta1/:parent/glossaries", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:parent/glossaries"
payload = {
"endTime": "",
"entryCount": 0,
"inputConfig": { "gcsSource": { "inputUri": "" } },
"languageCodesSet": { "languageCodes": [] },
"languagePair": {
"sourceLanguageCode": "",
"targetLanguageCode": ""
},
"name": "",
"submitTime": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:parent/glossaries"
payload <- "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:parent/glossaries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v3beta1/:parent/glossaries') do |req|
req.body = "{\n \"endTime\": \"\",\n \"entryCount\": 0,\n \"inputConfig\": {\n \"gcsSource\": {\n \"inputUri\": \"\"\n }\n },\n \"languageCodesSet\": {\n \"languageCodes\": []\n },\n \"languagePair\": {\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n },\n \"name\": \"\",\n \"submitTime\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:parent/glossaries";
let payload = json!({
"endTime": "",
"entryCount": 0,
"inputConfig": json!({"gcsSource": json!({"inputUri": ""})}),
"languageCodesSet": json!({"languageCodes": ()}),
"languagePair": json!({
"sourceLanguageCode": "",
"targetLanguageCode": ""
}),
"name": "",
"submitTime": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v3beta1/:parent/glossaries \
--header 'content-type: application/json' \
--data '{
"endTime": "",
"entryCount": 0,
"inputConfig": {
"gcsSource": {
"inputUri": ""
}
},
"languageCodesSet": {
"languageCodes": []
},
"languagePair": {
"sourceLanguageCode": "",
"targetLanguageCode": ""
},
"name": "",
"submitTime": ""
}'
echo '{
"endTime": "",
"entryCount": 0,
"inputConfig": {
"gcsSource": {
"inputUri": ""
}
},
"languageCodesSet": {
"languageCodes": []
},
"languagePair": {
"sourceLanguageCode": "",
"targetLanguageCode": ""
},
"name": "",
"submitTime": ""
}' | \
http POST {{baseUrl}}/v3beta1/:parent/glossaries \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "endTime": "",\n "entryCount": 0,\n "inputConfig": {\n "gcsSource": {\n "inputUri": ""\n }\n },\n "languageCodesSet": {\n "languageCodes": []\n },\n "languagePair": {\n "sourceLanguageCode": "",\n "targetLanguageCode": ""\n },\n "name": "",\n "submitTime": ""\n}' \
--output-document \
- {{baseUrl}}/v3beta1/:parent/glossaries
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"endTime": "",
"entryCount": 0,
"inputConfig": ["gcsSource": ["inputUri": ""]],
"languageCodesSet": ["languageCodes": []],
"languagePair": [
"sourceLanguageCode": "",
"targetLanguageCode": ""
],
"name": "",
"submitTime": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:parent/glossaries")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
translate.projects.locations.glossaries.list
{{baseUrl}}/v3beta1/:parent/glossaries
QUERY PARAMS
parent
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:parent/glossaries");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v3beta1/:parent/glossaries")
require "http/client"
url = "{{baseUrl}}/v3beta1/:parent/glossaries"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:parent/glossaries"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:parent/glossaries");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:parent/glossaries"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v3beta1/:parent/glossaries HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v3beta1/:parent/glossaries")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:parent/glossaries"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent/glossaries")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v3beta1/:parent/glossaries")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v3beta1/:parent/glossaries');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:parent/glossaries'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:parent/glossaries';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:parent/glossaries',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent/glossaries")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:parent/glossaries',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:parent/glossaries'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v3beta1/:parent/glossaries');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:parent/glossaries'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:parent/glossaries';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:parent/glossaries"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:parent/glossaries" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:parent/glossaries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v3beta1/:parent/glossaries');
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:parent/glossaries');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v3beta1/:parent/glossaries');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:parent/glossaries' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:parent/glossaries' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v3beta1/:parent/glossaries")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:parent/glossaries"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:parent/glossaries"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:parent/glossaries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v3beta1/:parent/glossaries') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:parent/glossaries";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v3beta1/:parent/glossaries
http GET {{baseUrl}}/v3beta1/:parent/glossaries
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v3beta1/:parent/glossaries
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:parent/glossaries")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
translate.projects.locations.list
{{baseUrl}}/v3beta1/:name/locations
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:name/locations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v3beta1/:name/locations")
require "http/client"
url = "{{baseUrl}}/v3beta1/:name/locations"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:name/locations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:name/locations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:name/locations"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v3beta1/:name/locations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v3beta1/:name/locations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:name/locations"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:name/locations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v3beta1/:name/locations")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v3beta1/:name/locations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name/locations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:name/locations';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:name/locations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:name/locations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:name/locations',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name/locations'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v3beta1/:name/locations');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name/locations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:name/locations';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:name/locations"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:name/locations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:name/locations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v3beta1/:name/locations');
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:name/locations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v3beta1/:name/locations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:name/locations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:name/locations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v3beta1/:name/locations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:name/locations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:name/locations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:name/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v3beta1/:name/locations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:name/locations";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v3beta1/:name/locations
http GET {{baseUrl}}/v3beta1/:name/locations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v3beta1/:name/locations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:name/locations")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
translate.projects.locations.operations.cancel
{{baseUrl}}/v3beta1/:name:cancel
QUERY PARAMS
name
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:name:cancel");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v3beta1/:name:cancel" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/v3beta1/:name:cancel"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:name:cancel"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:name:cancel");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:name:cancel"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v3beta1/:name:cancel HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v3beta1/:name:cancel")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:name:cancel"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:name:cancel")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v3beta1/:name:cancel")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v3beta1/:name:cancel');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:name:cancel',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:name:cancel';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:name:cancel',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:name:cancel")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:name:cancel',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:name:cancel',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v3beta1/:name:cancel');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:name:cancel',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:name:cancel';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:name:cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:name:cancel" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:name:cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v3beta1/:name:cancel', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:name:cancel');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/v3beta1/:name:cancel');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:name:cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:name:cancel' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v3beta1/:name:cancel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:name:cancel"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:name:cancel"
payload <- "{}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:name:cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v3beta1/:name:cancel') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:name:cancel";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v3beta1/:name:cancel \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/v3beta1/:name:cancel \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/v3beta1/:name:cancel
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:name:cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
translate.projects.locations.operations.delete
{{baseUrl}}/v3beta1/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v3beta1/:name")
require "http/client"
url = "{{baseUrl}}/v3beta1/:name"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:name");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:name"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v3beta1/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v3beta1/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:name"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:name")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v3beta1/:name")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v3beta1/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/v3beta1/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:name';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:name',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:name")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/v3beta1/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v3beta1/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/v3beta1/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:name';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:name" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:name",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v3beta1/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:name');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v3beta1/:name');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:name' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:name' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/v3beta1/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:name"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:name"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v3beta1/:name') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:name";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v3beta1/:name
http DELETE {{baseUrl}}/v3beta1/:name
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/v3beta1/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
translate.projects.locations.operations.get
{{baseUrl}}/v3beta1/:name
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v3beta1/:name")
require "http/client"
url = "{{baseUrl}}/v3beta1/:name"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:name");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:name"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v3beta1/:name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v3beta1/:name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:name"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:name")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v3beta1/:name")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v3beta1/:name');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:name';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:name',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:name")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v3beta1/:name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:name';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:name" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:name",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v3beta1/:name');
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:name');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v3beta1/:name');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:name' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:name' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v3beta1/:name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:name"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:name"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v3beta1/:name') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:name";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v3beta1/:name
http GET {{baseUrl}}/v3beta1/:name
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v3beta1/:name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
translate.projects.locations.operations.list
{{baseUrl}}/v3beta1/:name/operations
QUERY PARAMS
name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:name/operations");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/v3beta1/:name/operations")
require "http/client"
url = "{{baseUrl}}/v3beta1/:name/operations"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:name/operations"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:name/operations");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:name/operations"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/v3beta1/:name/operations HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/v3beta1/:name/operations")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:name/operations"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:name/operations")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/v3beta1/:name/operations")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/v3beta1/:name/operations');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name/operations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:name/operations';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:name/operations',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:name/operations")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:name/operations',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name/operations'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/v3beta1/:name/operations');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/v3beta1/:name/operations'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:name/operations';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:name/operations"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:name/operations" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:name/operations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/v3beta1/:name/operations');
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:name/operations');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v3beta1/:name/operations');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:name/operations' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:name/operations' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/v3beta1/:name/operations")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:name/operations"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:name/operations"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:name/operations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/v3beta1/:name/operations') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:name/operations";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/v3beta1/:name/operations
http GET {{baseUrl}}/v3beta1/:name/operations
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/v3beta1/:name/operations
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:name/operations")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
translate.projects.locations.operations.wait
{{baseUrl}}/v3beta1/:name:wait
QUERY PARAMS
name
BODY json
{
"timeout": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:name:wait");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"timeout\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v3beta1/:name:wait" {:content-type :json
:form-params {:timeout ""}})
require "http/client"
url = "{{baseUrl}}/v3beta1/:name:wait"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"timeout\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:name:wait"),
Content = new StringContent("{\n \"timeout\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:name:wait");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"timeout\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:name:wait"
payload := strings.NewReader("{\n \"timeout\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v3beta1/:name:wait HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 19
{
"timeout": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v3beta1/:name:wait")
.setHeader("content-type", "application/json")
.setBody("{\n \"timeout\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:name:wait"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"timeout\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"timeout\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:name:wait")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v3beta1/:name:wait")
.header("content-type", "application/json")
.body("{\n \"timeout\": \"\"\n}")
.asString();
const data = JSON.stringify({
timeout: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v3beta1/:name:wait');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:name:wait',
headers: {'content-type': 'application/json'},
data: {timeout: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:name:wait';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"timeout":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:name:wait',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "timeout": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"timeout\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:name:wait")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:name:wait',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({timeout: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:name:wait',
headers: {'content-type': 'application/json'},
body: {timeout: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v3beta1/:name:wait');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
timeout: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:name:wait',
headers: {'content-type': 'application/json'},
data: {timeout: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:name:wait';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"timeout":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"timeout": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:name:wait"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:name:wait" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"timeout\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:name:wait",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'timeout' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v3beta1/:name:wait', [
'body' => '{
"timeout": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:name:wait');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'timeout' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'timeout' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v3beta1/:name:wait');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:name:wait' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"timeout": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:name:wait' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"timeout": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"timeout\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v3beta1/:name:wait", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:name:wait"
payload = { "timeout": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:name:wait"
payload <- "{\n \"timeout\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:name:wait")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"timeout\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v3beta1/:name:wait') do |req|
req.body = "{\n \"timeout\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:name:wait";
let payload = json!({"timeout": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v3beta1/:name:wait \
--header 'content-type: application/json' \
--data '{
"timeout": ""
}'
echo '{
"timeout": ""
}' | \
http POST {{baseUrl}}/v3beta1/:name:wait \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "timeout": ""\n}' \
--output-document \
- {{baseUrl}}/v3beta1/:name:wait
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["timeout": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:name:wait")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
translate.projects.locations.translateDocument
{{baseUrl}}/v3beta1/:parent:translateDocument
QUERY PARAMS
parent
BODY json
{
"customizedAttribution": "",
"documentInputConfig": {
"content": "",
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
},
"documentOutputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
},
"mimeType": ""
},
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"isTranslateNativePdfOnly": false,
"labels": {},
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:parent:translateDocument");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v3beta1/:parent:translateDocument" {:content-type :json
:form-params {:customizedAttribution ""
:documentInputConfig {:content ""
:gcsSource {:inputUri ""}
:mimeType ""}
:documentOutputConfig {:gcsDestination {:outputUriPrefix ""}
:mimeType ""}
:enableRotationCorrection false
:enableShadowRemovalNativePdf false
:glossaryConfig {:glossary ""
:ignoreCase false}
:isTranslateNativePdfOnly false
:labels {}
:model ""
:sourceLanguageCode ""
:targetLanguageCode ""}})
require "http/client"
url = "{{baseUrl}}/v3beta1/:parent:translateDocument"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:parent:translateDocument"),
Content = new StringContent("{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:parent:translateDocument");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:parent:translateDocument"
payload := strings.NewReader("{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v3beta1/:parent:translateDocument HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 534
{
"customizedAttribution": "",
"documentInputConfig": {
"content": "",
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
},
"documentOutputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
},
"mimeType": ""
},
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"isTranslateNativePdfOnly": false,
"labels": {},
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v3beta1/:parent:translateDocument")
.setHeader("content-type", "application/json")
.setBody("{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:parent:translateDocument"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:translateDocument")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v3beta1/:parent:translateDocument")
.header("content-type", "application/json")
.body("{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
.asString();
const data = JSON.stringify({
customizedAttribution: '',
documentInputConfig: {
content: '',
gcsSource: {
inputUri: ''
},
mimeType: ''
},
documentOutputConfig: {
gcsDestination: {
outputUriPrefix: ''
},
mimeType: ''
},
enableRotationCorrection: false,
enableShadowRemovalNativePdf: false,
glossaryConfig: {
glossary: '',
ignoreCase: false
},
isTranslateNativePdfOnly: false,
labels: {},
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v3beta1/:parent:translateDocument');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:translateDocument',
headers: {'content-type': 'application/json'},
data: {
customizedAttribution: '',
documentInputConfig: {content: '', gcsSource: {inputUri: ''}, mimeType: ''},
documentOutputConfig: {gcsDestination: {outputUriPrefix: ''}, mimeType: ''},
enableRotationCorrection: false,
enableShadowRemovalNativePdf: false,
glossaryConfig: {glossary: '', ignoreCase: false},
isTranslateNativePdfOnly: false,
labels: {},
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:parent:translateDocument';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customizedAttribution":"","documentInputConfig":{"content":"","gcsSource":{"inputUri":""},"mimeType":""},"documentOutputConfig":{"gcsDestination":{"outputUriPrefix":""},"mimeType":""},"enableRotationCorrection":false,"enableShadowRemovalNativePdf":false,"glossaryConfig":{"glossary":"","ignoreCase":false},"isTranslateNativePdfOnly":false,"labels":{},"model":"","sourceLanguageCode":"","targetLanguageCode":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:parent:translateDocument',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "customizedAttribution": "",\n "documentInputConfig": {\n "content": "",\n "gcsSource": {\n "inputUri": ""\n },\n "mimeType": ""\n },\n "documentOutputConfig": {\n "gcsDestination": {\n "outputUriPrefix": ""\n },\n "mimeType": ""\n },\n "enableRotationCorrection": false,\n "enableShadowRemovalNativePdf": false,\n "glossaryConfig": {\n "glossary": "",\n "ignoreCase": false\n },\n "isTranslateNativePdfOnly": false,\n "labels": {},\n "model": "",\n "sourceLanguageCode": "",\n "targetLanguageCode": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:translateDocument")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:parent:translateDocument',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
customizedAttribution: '',
documentInputConfig: {content: '', gcsSource: {inputUri: ''}, mimeType: ''},
documentOutputConfig: {gcsDestination: {outputUriPrefix: ''}, mimeType: ''},
enableRotationCorrection: false,
enableShadowRemovalNativePdf: false,
glossaryConfig: {glossary: '', ignoreCase: false},
isTranslateNativePdfOnly: false,
labels: {},
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:translateDocument',
headers: {'content-type': 'application/json'},
body: {
customizedAttribution: '',
documentInputConfig: {content: '', gcsSource: {inputUri: ''}, mimeType: ''},
documentOutputConfig: {gcsDestination: {outputUriPrefix: ''}, mimeType: ''},
enableRotationCorrection: false,
enableShadowRemovalNativePdf: false,
glossaryConfig: {glossary: '', ignoreCase: false},
isTranslateNativePdfOnly: false,
labels: {},
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v3beta1/:parent:translateDocument');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
customizedAttribution: '',
documentInputConfig: {
content: '',
gcsSource: {
inputUri: ''
},
mimeType: ''
},
documentOutputConfig: {
gcsDestination: {
outputUriPrefix: ''
},
mimeType: ''
},
enableRotationCorrection: false,
enableShadowRemovalNativePdf: false,
glossaryConfig: {
glossary: '',
ignoreCase: false
},
isTranslateNativePdfOnly: false,
labels: {},
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:translateDocument',
headers: {'content-type': 'application/json'},
data: {
customizedAttribution: '',
documentInputConfig: {content: '', gcsSource: {inputUri: ''}, mimeType: ''},
documentOutputConfig: {gcsDestination: {outputUriPrefix: ''}, mimeType: ''},
enableRotationCorrection: false,
enableShadowRemovalNativePdf: false,
glossaryConfig: {glossary: '', ignoreCase: false},
isTranslateNativePdfOnly: false,
labels: {},
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:parent:translateDocument';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customizedAttribution":"","documentInputConfig":{"content":"","gcsSource":{"inputUri":""},"mimeType":""},"documentOutputConfig":{"gcsDestination":{"outputUriPrefix":""},"mimeType":""},"enableRotationCorrection":false,"enableShadowRemovalNativePdf":false,"glossaryConfig":{"glossary":"","ignoreCase":false},"isTranslateNativePdfOnly":false,"labels":{},"model":"","sourceLanguageCode":"","targetLanguageCode":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"customizedAttribution": @"",
@"documentInputConfig": @{ @"content": @"", @"gcsSource": @{ @"inputUri": @"" }, @"mimeType": @"" },
@"documentOutputConfig": @{ @"gcsDestination": @{ @"outputUriPrefix": @"" }, @"mimeType": @"" },
@"enableRotationCorrection": @NO,
@"enableShadowRemovalNativePdf": @NO,
@"glossaryConfig": @{ @"glossary": @"", @"ignoreCase": @NO },
@"isTranslateNativePdfOnly": @NO,
@"labels": @{ },
@"model": @"",
@"sourceLanguageCode": @"",
@"targetLanguageCode": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:parent:translateDocument"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:parent:translateDocument" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:parent:translateDocument",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customizedAttribution' => '',
'documentInputConfig' => [
'content' => '',
'gcsSource' => [
'inputUri' => ''
],
'mimeType' => ''
],
'documentOutputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
],
'mimeType' => ''
],
'enableRotationCorrection' => null,
'enableShadowRemovalNativePdf' => null,
'glossaryConfig' => [
'glossary' => '',
'ignoreCase' => null
],
'isTranslateNativePdfOnly' => null,
'labels' => [
],
'model' => '',
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v3beta1/:parent:translateDocument', [
'body' => '{
"customizedAttribution": "",
"documentInputConfig": {
"content": "",
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
},
"documentOutputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
},
"mimeType": ""
},
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"isTranslateNativePdfOnly": false,
"labels": {},
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:parent:translateDocument');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'customizedAttribution' => '',
'documentInputConfig' => [
'content' => '',
'gcsSource' => [
'inputUri' => ''
],
'mimeType' => ''
],
'documentOutputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
],
'mimeType' => ''
],
'enableRotationCorrection' => null,
'enableShadowRemovalNativePdf' => null,
'glossaryConfig' => [
'glossary' => '',
'ignoreCase' => null
],
'isTranslateNativePdfOnly' => null,
'labels' => [
],
'model' => '',
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'customizedAttribution' => '',
'documentInputConfig' => [
'content' => '',
'gcsSource' => [
'inputUri' => ''
],
'mimeType' => ''
],
'documentOutputConfig' => [
'gcsDestination' => [
'outputUriPrefix' => ''
],
'mimeType' => ''
],
'enableRotationCorrection' => null,
'enableShadowRemovalNativePdf' => null,
'glossaryConfig' => [
'glossary' => '',
'ignoreCase' => null
],
'isTranslateNativePdfOnly' => null,
'labels' => [
],
'model' => '',
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v3beta1/:parent:translateDocument');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:parent:translateDocument' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customizedAttribution": "",
"documentInputConfig": {
"content": "",
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
},
"documentOutputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
},
"mimeType": ""
},
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"isTranslateNativePdfOnly": false,
"labels": {},
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:parent:translateDocument' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customizedAttribution": "",
"documentInputConfig": {
"content": "",
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
},
"documentOutputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
},
"mimeType": ""
},
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"isTranslateNativePdfOnly": false,
"labels": {},
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v3beta1/:parent:translateDocument", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:parent:translateDocument"
payload = {
"customizedAttribution": "",
"documentInputConfig": {
"content": "",
"gcsSource": { "inputUri": "" },
"mimeType": ""
},
"documentOutputConfig": {
"gcsDestination": { "outputUriPrefix": "" },
"mimeType": ""
},
"enableRotationCorrection": False,
"enableShadowRemovalNativePdf": False,
"glossaryConfig": {
"glossary": "",
"ignoreCase": False
},
"isTranslateNativePdfOnly": False,
"labels": {},
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:parent:translateDocument"
payload <- "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:parent:translateDocument")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v3beta1/:parent:translateDocument') do |req|
req.body = "{\n \"customizedAttribution\": \"\",\n \"documentInputConfig\": {\n \"content\": \"\",\n \"gcsSource\": {\n \"inputUri\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"documentOutputConfig\": {\n \"gcsDestination\": {\n \"outputUriPrefix\": \"\"\n },\n \"mimeType\": \"\"\n },\n \"enableRotationCorrection\": false,\n \"enableShadowRemovalNativePdf\": false,\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"isTranslateNativePdfOnly\": false,\n \"labels\": {},\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:parent:translateDocument";
let payload = json!({
"customizedAttribution": "",
"documentInputConfig": json!({
"content": "",
"gcsSource": json!({"inputUri": ""}),
"mimeType": ""
}),
"documentOutputConfig": json!({
"gcsDestination": json!({"outputUriPrefix": ""}),
"mimeType": ""
}),
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": json!({
"glossary": "",
"ignoreCase": false
}),
"isTranslateNativePdfOnly": false,
"labels": json!({}),
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v3beta1/:parent:translateDocument \
--header 'content-type: application/json' \
--data '{
"customizedAttribution": "",
"documentInputConfig": {
"content": "",
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
},
"documentOutputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
},
"mimeType": ""
},
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"isTranslateNativePdfOnly": false,
"labels": {},
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}'
echo '{
"customizedAttribution": "",
"documentInputConfig": {
"content": "",
"gcsSource": {
"inputUri": ""
},
"mimeType": ""
},
"documentOutputConfig": {
"gcsDestination": {
"outputUriPrefix": ""
},
"mimeType": ""
},
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"isTranslateNativePdfOnly": false,
"labels": {},
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}' | \
http POST {{baseUrl}}/v3beta1/:parent:translateDocument \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "customizedAttribution": "",\n "documentInputConfig": {\n "content": "",\n "gcsSource": {\n "inputUri": ""\n },\n "mimeType": ""\n },\n "documentOutputConfig": {\n "gcsDestination": {\n "outputUriPrefix": ""\n },\n "mimeType": ""\n },\n "enableRotationCorrection": false,\n "enableShadowRemovalNativePdf": false,\n "glossaryConfig": {\n "glossary": "",\n "ignoreCase": false\n },\n "isTranslateNativePdfOnly": false,\n "labels": {},\n "model": "",\n "sourceLanguageCode": "",\n "targetLanguageCode": ""\n}' \
--output-document \
- {{baseUrl}}/v3beta1/:parent:translateDocument
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"customizedAttribution": "",
"documentInputConfig": [
"content": "",
"gcsSource": ["inputUri": ""],
"mimeType": ""
],
"documentOutputConfig": [
"gcsDestination": ["outputUriPrefix": ""],
"mimeType": ""
],
"enableRotationCorrection": false,
"enableShadowRemovalNativePdf": false,
"glossaryConfig": [
"glossary": "",
"ignoreCase": false
],
"isTranslateNativePdfOnly": false,
"labels": [],
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:parent:translateDocument")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
translate.projects.locations.translateText
{{baseUrl}}/v3beta1/:parent:translateText
QUERY PARAMS
parent
BODY json
{
"contents": [],
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"labels": {},
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v3beta1/:parent:translateText");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v3beta1/:parent:translateText" {:content-type :json
:form-params {:contents []
:glossaryConfig {:glossary ""
:ignoreCase false}
:labels {}
:mimeType ""
:model ""
:sourceLanguageCode ""
:targetLanguageCode ""}})
require "http/client"
url = "{{baseUrl}}/v3beta1/:parent:translateText"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v3beta1/:parent:translateText"),
Content = new StringContent("{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v3beta1/:parent:translateText");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v3beta1/:parent:translateText"
payload := strings.NewReader("{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v3beta1/:parent:translateText HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 196
{
"contents": [],
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"labels": {},
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v3beta1/:parent:translateText")
.setHeader("content-type", "application/json")
.setBody("{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v3beta1/:parent:translateText"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:translateText")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v3beta1/:parent:translateText")
.header("content-type", "application/json")
.body("{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
.asString();
const data = JSON.stringify({
contents: [],
glossaryConfig: {
glossary: '',
ignoreCase: false
},
labels: {},
mimeType: '',
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v3beta1/:parent:translateText');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:translateText',
headers: {'content-type': 'application/json'},
data: {
contents: [],
glossaryConfig: {glossary: '', ignoreCase: false},
labels: {},
mimeType: '',
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v3beta1/:parent:translateText';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"contents":[],"glossaryConfig":{"glossary":"","ignoreCase":false},"labels":{},"mimeType":"","model":"","sourceLanguageCode":"","targetLanguageCode":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v3beta1/:parent:translateText',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "contents": [],\n "glossaryConfig": {\n "glossary": "",\n "ignoreCase": false\n },\n "labels": {},\n "mimeType": "",\n "model": "",\n "sourceLanguageCode": "",\n "targetLanguageCode": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v3beta1/:parent:translateText")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v3beta1/:parent:translateText',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
contents: [],
glossaryConfig: {glossary: '', ignoreCase: false},
labels: {},
mimeType: '',
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:translateText',
headers: {'content-type': 'application/json'},
body: {
contents: [],
glossaryConfig: {glossary: '', ignoreCase: false},
labels: {},
mimeType: '',
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v3beta1/:parent:translateText');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
contents: [],
glossaryConfig: {
glossary: '',
ignoreCase: false
},
labels: {},
mimeType: '',
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v3beta1/:parent:translateText',
headers: {'content-type': 'application/json'},
data: {
contents: [],
glossaryConfig: {glossary: '', ignoreCase: false},
labels: {},
mimeType: '',
model: '',
sourceLanguageCode: '',
targetLanguageCode: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v3beta1/:parent:translateText';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"contents":[],"glossaryConfig":{"glossary":"","ignoreCase":false},"labels":{},"mimeType":"","model":"","sourceLanguageCode":"","targetLanguageCode":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"contents": @[ ],
@"glossaryConfig": @{ @"glossary": @"", @"ignoreCase": @NO },
@"labels": @{ },
@"mimeType": @"",
@"model": @"",
@"sourceLanguageCode": @"",
@"targetLanguageCode": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v3beta1/:parent:translateText"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v3beta1/:parent:translateText" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v3beta1/:parent:translateText",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contents' => [
],
'glossaryConfig' => [
'glossary' => '',
'ignoreCase' => null
],
'labels' => [
],
'mimeType' => '',
'model' => '',
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v3beta1/:parent:translateText', [
'body' => '{
"contents": [],
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"labels": {},
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v3beta1/:parent:translateText');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'contents' => [
],
'glossaryConfig' => [
'glossary' => '',
'ignoreCase' => null
],
'labels' => [
],
'mimeType' => '',
'model' => '',
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'contents' => [
],
'glossaryConfig' => [
'glossary' => '',
'ignoreCase' => null
],
'labels' => [
],
'mimeType' => '',
'model' => '',
'sourceLanguageCode' => '',
'targetLanguageCode' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v3beta1/:parent:translateText');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v3beta1/:parent:translateText' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"contents": [],
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"labels": {},
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v3beta1/:parent:translateText' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"contents": [],
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"labels": {},
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/v3beta1/:parent:translateText", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v3beta1/:parent:translateText"
payload = {
"contents": [],
"glossaryConfig": {
"glossary": "",
"ignoreCase": False
},
"labels": {},
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v3beta1/:parent:translateText"
payload <- "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v3beta1/:parent:translateText")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v3beta1/:parent:translateText') do |req|
req.body = "{\n \"contents\": [],\n \"glossaryConfig\": {\n \"glossary\": \"\",\n \"ignoreCase\": false\n },\n \"labels\": {},\n \"mimeType\": \"\",\n \"model\": \"\",\n \"sourceLanguageCode\": \"\",\n \"targetLanguageCode\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v3beta1/:parent:translateText";
let payload = json!({
"contents": (),
"glossaryConfig": json!({
"glossary": "",
"ignoreCase": false
}),
"labels": json!({}),
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v3beta1/:parent:translateText \
--header 'content-type: application/json' \
--data '{
"contents": [],
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"labels": {},
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}'
echo '{
"contents": [],
"glossaryConfig": {
"glossary": "",
"ignoreCase": false
},
"labels": {},
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
}' | \
http POST {{baseUrl}}/v3beta1/:parent:translateText \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "contents": [],\n "glossaryConfig": {\n "glossary": "",\n "ignoreCase": false\n },\n "labels": {},\n "mimeType": "",\n "model": "",\n "sourceLanguageCode": "",\n "targetLanguageCode": ""\n}' \
--output-document \
- {{baseUrl}}/v3beta1/:parent:translateText
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"contents": [],
"glossaryConfig": [
"glossary": "",
"ignoreCase": false
],
"labels": [],
"mimeType": "",
"model": "",
"sourceLanguageCode": "",
"targetLanguageCode": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v3beta1/:parent:translateText")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()