此API不支持解析表单编码输入

时间:2022-10-24 12:55:15

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:

我试图将数据提交到端点,但它说数据大小太大,所以我将方法更改为POST并收到错误:

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:

接下来我将类型更改为application / json,仍然使用post,现在我得到:

{
"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.

将大量数据(即2730字节)发布到端点并使其正确处理的最佳方法是什么?在我的情况下,有问题的字段是Text类型,因为我超过500个字符限制,app引擎要保存在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 个解决方案

#1


24  

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:

不确定您的问题是否相关,但我收到“此API不支持解析表单编码输入”。我尝试使用curl发送这样的POST消息时出错:

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.

问题是我没有设置内容类型。如果在命令行中未指定,则使用Content-Type卷曲POST:application / x-www-form-urlencoded。 Google云端点不接受此内容类型。

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

当我更改curl调用以包含内容类型时,它工作:

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

#1


24  

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:

不确定您的问题是否相关,但我收到“此API不支持解析表单编码输入”。我尝试使用curl发送这样的POST消息时出错:

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.

问题是我没有设置内容类型。如果在命令行中未指定,则使用Content-Type卷曲POST:application / x-www-form-urlencoded。 Google云端点不接受此内容类型。

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

当我更改curl调用以包含内容类型时,它工作:

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