rest - SuiteCrm Rest API:调用 POST 或 PUT 时 JSON 正文属性引发错误
问题描述
我正在使用邮递员来调用 SuiteCRM REST API。
我试图调用这个端点
PATCH http://{{suitecrm-url}}/Api/V8/module
我已将此有效负载添加到正文(内容类型:应用程序/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中提到的人:
这仅用于临时修复而不是安全升级
推荐阅读
- python - 如何将类似日期时间的字符串转换为毫秒
- delphi - FireDAC 将 Access 文件中的数据加载到 DBGrid 中,而不使用拖放控件
- python-3.x - 设置 nginx.conf 以根据原始 uri 路由 2 个不同的本地 wsgi
- visual-c++ - 如何将 std::variant 作为 VARIANT* 传递给 ExecWB?
- html - 为什么在这种情况下左右浮动不起作用?
- gradle - 无法解决:org.jetbrains.pty4j:pty4j:0.9.8
- macos - 我无法从手机访问 Mac 本地主机
- javascript - 更新列表并重新渲染 vue-template
- terraform - 在 terraform 中设置 gke 自动驾驶仪的好例子
- webpack-dev-server - 使用vue作为Multi Page Application时,各个入口点内部目录中的组件不能共用