groupstudent
groupstudent

Reputation: 4317

How to use google REST API?

This is my first time to use this kind of API. And I thought I was following the instruction. I created a project in console and use the REST GET command

curl https://www.googleapis.com/language/translate/v2?key=AIzaSyCTBfJhbBALXOzV_UgPga-ViBUZbtsWqMU&source=en&target=de&q=Hello%20world&q=My%20name%20is%20Jeff

Why this can't work? It sent back:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Required parameter: q",
    "locationType": "parameter",
    "location": "q"
   },
   {
    "domain": "global",
    "reason": "required",
    "message": "Required parameter: target",
    "locationType": "parameter",
    "location": "target"
   }
  ],
  "code": 400,
  "message": "Required parameter: q"
 }
}

Thank you.

Upvotes: 0

Views: 164

Answers (1)

abraham
abraham

Reputation: 47923

For curl you need to wrap URLs that have params with quotes.

curl "https://www.googleapis.com/language/translate/v2?key=AIzaSyCTBfJhbBALXOzV_UgPga-ViBUZbtsWqMU&source=en&target=de&q=Hello%20world&q=My%20name%20is%20Jeff"

Upvotes: 1

Related Questions