问题描述
我想通过跑道 API 向跑道项目添加标签,但我正在努力正确格式化 json 正文。
当我收到 400 时,我想我的请求是正确的,问题出在 json 格式中。请参阅下面的代码。
有什么建议吗?
为了确保,我使用 Integromat 进行 API 调用(Podio 的“进行 API 调用”模块)
{
"response": {
"status": 400,"headers": {
"date": "Tue,16 Mar 2021 12:10:31 GMT","content-type": "application/json; charset=utf-8","content-length": "291","connection": "close","server": "Nginx","x-rate-limit-remaining": "9990","x-rate-limit-limit": "10000","x-podio-auth-ref": "********","x-podio-request-id": "********"
},"body": {
"error_parameters": {},"error_detail": null,"error_propagate": false,"request": {
"url": "http://api.podio.com/tag/item/***********/","query_string": "","method": "POST"
},"error_description": "Invalid value {\"{text}\": [\"test1\",\"test2\"]} (object): must be array","error": "invalid_value"
}
},"request": {
"url": "https://api.podio.com/tag/item/***********/",/","headers": {
"Authorization": "***","User-Agent": "Integromat/production"
},"method": "POST","body": {
"{text}": [
"test1","test2"
]
}
}
}
解决方法
你的身体有问题。
如果您想创建值为“test1”和“test2”的标签,您的主体应该是:
["foo","bar"]
它应该是一个 JSON 标签数组。