IBM Cloud Docs
发出 cURL API 请求时是否收到 binding_error 代码?

发出 cURL API 请求时是否收到 binding_error 代码?

如果在 API 请求中使用单引号,那么请求将失败并返回绑定错误。

API 请求失败,响应返回绑定错误。

在 cURL 请求的头 (例如 -H 'Authorization: $ACCESS_TOKEN' -H 'content-type: application/json') 中使用单引号时,可能会迂到 binding_error 问题。

{"trace":"70684768-53ae-476f-bec7-2d923bb5f14c","errors":[{"code":"binding_error","message":"The input parameters in the request body are either incomplete or in the wrong format. See detailed error: invalid character 'n' looking for beginning of object key string."}]}curl: (6) Could not resolve host: COS
curl: (6) Could not resolve host: target
curl: (3) [globbing] unmatched close brace/bracket in column 389

检查 cURL 请求中的头是否设置了双引号。

-H "Authorization:  $ACCESS_TOKEN"   -H "content-type: application/json"