我使用 postman 来调用 SuiteCRM REST API。
我尝试调用此端点
PATCH http://{{suitecrm-url}}/Api/V8/module
我已将此有效负载添加到正文中(内容类型:Application/Json):
{
"data": {
"type": "Accounts",
"id": "3a3ae651-d509-2508-7dc4-5be2e51cc96b",
"attributes": {
"name": "name with space"
}
}
}
执行请求时 SuiteCRM 给出以下响应:
{
"errors": {
"status": 400,
"title": null,
"detail": "The option \"attributes\" with value array is invalid."
}
}
我发现问题是值中的空格:当我尝试使用值“namewithspace”时,它起作用了。
有人知道如何解决这个问题吗?
提前致谢
最佳答案
我在 github 上发现了这个问题,解决了我的问题:
https://github.com/salesagility/SuiteCRM/issues/6452
简而言之,为了使其工作,我必须修改文件
/Api/V8/Params/Options/Fields.php
并替换此行
const REGEX_FIELD_PATTERN = '/[^\w-,]/';
与
const REGEX_FIELD_PATTERN = '/[^\w-,\s\]/';
github中提到的人:
this is just for temporary fix and not upgrade safe
关于rest - SuiteCrm 休息 API : JSON Body attributes throws error when calling POST or PUT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53397092/