This API does not support parsing form-encoded inp

2019-03-18 00:32发布

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!

1条回答
啃猪蹄的小仙女
2楼-- · 2019-03-18 01:08

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
查看更多
登录 后发表回答