google-translate icon indicating copy to clipboard operation
google-translate copied to clipboard

change base url to translation.googleapis.com

Open srghma opened this issue 4 years ago • 3 comments

as in a guide here https://cloud.google.com/translate/docs/reference/rest/v2/translate

srghma avatar Dec 20 '20 10:12 srghma

the GET should be changed to POST

srghma avatar Dec 20 '20 11:12 srghma

curl example

export GOOGLE_APPLICATION_CREDENTIALS="/home/srghma/Downloads/My First Project-93b2e4e681f8.json"

json='
{
  "q": "angekommen",
  "source": "de",
  "target": "ru"
}
'
echo $json | curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @- \
https://translation.googleapis.com/language/translate/v2

srghma avatar Dec 20 '20 11:12 srghma

@srghma can you change the GET to POST too ?

dmjio avatar Dec 21 '20 03:12 dmjio