【发布时间】:2015-04-06 20:07:57
【问题描述】:
我正在尝试使用 Postman 来解决我遇到的 API 错误。我正在使用 OAuth 进行身份验证,因此我发布了标题和表单数据。但是,似乎我遇到的错误与表单数据有关。我也尝试将'Content-Type'设置为'application/json; charset=utf-8' 和没有。结果相同。
{
"error": "795: unexpected token at '------WebKitFormBoundaryoRBw9tLdltLHfrtU\r\nContent- Disposition: form-data; name=\"topic\"\r\n\r\ncheckouts/update\r\n------WebKitFormBoundaryoRBw9tLdltLHfrtU\r\nContent-Disposition: form-data; name=\"address\"\r\n\r\nhttps://mysite.co/checkout/\r\n------WebKitFormBoundaryoRBw9tLdltLHfrtU\r\nContent-Disposition: form-data; name=\"format\"\r\n\r\njson\r\n------WebKitFormBoundaryoRBw9tLdltLHfrtU--\r\n'"
}
我认为 Postman 会在 API 正确读取我的数据之前对其进行转义。任何想法如何让邮递员停止过早地转义我的数据?似乎没有任何问题。
请求正文:
"webhook":[{"topic": "checkouts/update","address": "https://mysite.co/checkout","format": "json"}]
【问题讨论】:
-
你能告诉我们请求的正文吗?也许问题就藏在那里。我不认为邮递员是问题。
-
@LaurentJalbertSimard 当然,在这里。
-
我使用的大多数 API 都需要将 Json 属性包含在 json 对象中,如下所示:
{ "webhook":[{"topic": "checkouts/update","address": "https://mysite.co/checkout","format": "json"}] } -
这确实是错误。您可以将其添加为答案吗?谢谢