SAP API Business Hub 上测试 API 的一些常见问题

在 Process Visibility Scenario 的 workflow 执行日志里,能找到 BUSINESS_RULES Destination 对应的正确的 endpoint:

显然,下图我配置的 environment 里 request url 不正确,少了 rule 片段:

错误消息:

404 Not Found: Requested route ('bpmruleruntime.cfapps.ap21.hana.ondemand.com') does not exist.

错误的 url:

https://bpmruleruntime.cfapps.ap21.hana.ondemand.com/rules-service/rest/v2/rule-services

正确的 url:

POST https://bpmruleruntime.rule.cfapps.ap21.hana.ondemand.com/rules-service/rest/v2/rule-services

bpmruleruntime.rule.cfapps.ap21.hana.ondemand.com

纠正了 url 之后,错误消息又变了:

{
  "error": {
    "code": "bpm.rulesruntime.invalidPayload",
    "message": "Provide a value for rule service version and revision",
    "details": []
  }
}

这是因为请求正文格式不正确,或者缺少必填字段造成的。

另一种错误:

Provide a value for rule service version and revision

{
  "error": {
    "code": "bpm.rulesruntime.internalservererror",
    "message": "Error encountered during processing of request",
    "details": []
  }
}

显然,请求里没有指定 service version 和 revision version 这两个值。

下图是正确的值:

{ 
  "RuleServiceId": "f27730d10cce4525ae111e647054d8f7",
"RuleServiceVersion":"000001000000000000",
"RuleServiceRevision":"JerryFirstVersion",
"Vocabulary": [
    {
      "Employee": {
... 字段省略,读者需自行填充
       
       }
    }
  ]
}

最后返回 200 状态码,调用成功。

更多Jerry的原创文章,尽在:"汪子熙":


你可能感兴趣的:(SAP API Business Hub 上测试 API 的一些常见问题)