Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This API does not support parsing form-encoded input

I tried to submit data to an endpoint but it said the data size was too large, so I changed the method to POST and received the error:

This API does not support parsing form-encoded input.

Next I changed the type to application/json, still with post and now I am getting:

{
"error": {
  "errors": [
  {
    "domain": "global",
"reason": "parseError",
  "message": "Parse Error"
 }
 ],
  "code": 400,
 "message": "Parse Error"
 }
}

What is the best way to post a large amount of data, i.e. 2730 bytes to an endpoint and have it handle it properly? In my case the field in question is of type Text as I am over the 500 character limit for app engine to hold in a String.

Also, as with many things, this works great on my local machine, it only gives this error on the live app engine instance.

Thanks!

like image 624
Shaun Avatar asked Oct 09 '13 02:10

Shaun


1 Answers

Not sure if your problem is related, but I received the "This API does not support parsing form-encoded input." error when I was attempting to use curl to send a POST message like this:

curl -X POST -d '{"name": "Foo"}' http://foo.appspot.com/_ah/api/foo/1/endpoint

The problem was that I was not setting the content type. curl POSTs with Content-Type: application/x-www-form-urlencoded if it's not specified on the command line. Google cloud endpoints don't accept this content type.

When I changed the curl invocation to include the content type, it worked:

curl -X POST -d '{"name": "Foo"}' --header "Content-Type: application/json" http://foo.appspot.com/_ah/api/foo/1/endpoint
like image 101
Greg Avatar answered Nov 11 '22 06:11

Greg