3.9.11.6. 更新现有实体实例

可以使用 PUT 请求地址更新现有的 sales$Order 实体实例:

http://localhost:8080/app/rest/v2/entities/sales$Order/5d7ff8e3-7828-ba94-d6ba-155c5c4f2a50

这里查询的最后一部分是实体标识符。

必须将 OAuth 令牌放在带有 Bearer 类型的 Authorization 请求头中。

请求体必须包含一个只包含要更新的字段的 JSON 对象,例如:

  1. {
  2. "date": "2017-10-01",
  3. "customer" : {
  4. "id" : "5d111245-2ed0-abec-3bee-1a196da92e3e"
  5. }
  6. }

响应体将包含一个修改过的实体:

  1. {
  2. "_entityName": "sales$Order",
  3. "id": "5d7ff8e3-7828-ba94-d6ba-155c5c4f2a50",
  4. "date": "2017-10-01",
  5. "updatedBy": "admin",
  6. "description": "Back to school",
  7. "version": 2,
  8. "number": "00017",
  9. "createdBy": "admin",
  10. "createTs": "2016-10-13 18:12:21.047",
  11. "updateTs": "2016-10-13 19:13:02.656",
  12. "customer": {
  13. "_entityName": "sales$Customer",
  14. "id": "5d111245-2ed0-abec-3bee-1a196da92e3e",
  15. "firstName": "Morgan",
  16. "lastName": "Collins",
  17. "createdBy": "admin",
  18. "createTs": "2016-10-13 15:31:27.821",
  19. "version": 1,
  20. "updateTs": "2016-10-13 15:31:27.821",
  21. "email": "collins@gmail.com"
  22. }
  23. }