rest - SuiteCrm 休息 API : JSON Body attributes throws error when calling POST or PUT

标签 rest suitecrm

我使用 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/

相关文章:

java - 使用 JSON 的 Volley REST 客户端

web-services - 如何理解 SOAP Web 服务仅使用 HTTP 进行传输?

sugarcrm - SuiteCRM、SugarCRM : Many relationships "many-to-many" between same two modules

html - SugarCRM - 传入的电子邮件在正文标签外剥离

sugarcrm - 如何在SuiteCRM布局中添加字段条件?

java - java中的分割和验证比较表达式

java - 如何使用 JSON 响应通过 Rest Assured 基于正文项进行断言?

rest - 使用 JAX-RS 2.0 客户端 API 进行 POST

php - 在 Windows 7 中的 wamp 上安装 SuiteCRM 时出错

sugarcrm - SuiteCRM、糖CRM : Modifying the name of subpanels