Why do I get invalid JSON payload when calling google cloud vision API from appcelerator?
<p>I was trying to use Google vision API v1 by Alloy Appcelerator</p>

<p>I create a request HTTPClient and call API <a href="https://vision.googleapis.com/v1/images:annotate?key=MY_APP_KEY" rel="nofollow">https://vision.googleapis.com/v1/images:annotate?key=MY_APP_KEY</a></p>

<p>But i have get response text from google :</p>

<pre><code>  {
 error = {
     code = 400;
     details = (
                  {
                     "@type" = "type.googleapis.com/google.rpc.BadRequest";
                      fieldViolations = ({
                                        description = "Invalid JSON payload received. Unknown name \"request\": Cannot bind query parameter. Field 'request' could not be found in request message.";
                                        });
                  }
                );
     message = "Invalid JSON payload received. Unknown name \"request\": Cannot bind query parameter. Field 'request' could not be found in request message.";
     status = "INVALID_ARGUMENT";
  };
</code></pre>

<p>}</p>

<p>And there is my code use HTTP request by Alloy</p>

<pre><code>var requests =  
{
  "requests":[
    {
      "image":{
        "content": "image_have_encodebase64",
      },
      "features":[
        {
          "type":"TEXT_DETECTION",
          "maxResults":1
        }
      ]
    }
  ]
};
var xhr = Titanium.Network.createHTTPClient();
xhr.open("POST", 'https://vision.googleapis.com/v1/images:annotate?key=MY_APP_KEY');
xhr.send(JSON.stringify(requests));
</code></pre>

<p>Thanks for your help</p>