4

我们定义Asset为:

asset PurchaseOrder identified by orderId {
  o String orderId
    --> SupplierChainParticipant createdBy
    --> SupplierChainParticipant assignedTo
  o String description    
  o String status
  o Integer quantity
  o String assetId    
}

Participant作为:

participant SupplierChainParticipant  identified by participantId {
  o String participantId
  o String identity
  o String type     
}

现在,当我Asset使用 composer-rest-server 的 REST API 获取详细信息时,我收到以下响应:

{
  "orderId": "o5",
  "createdBy": "resource:com.supplychain-network.SupplierChainParticipant#p1",
  "assignedTo": "resource:com.supplychain-network.SupplierChainParticipant#p2",
  "description": "New Engine",
  "status": "created",
  "quantity": 1,
  "assetId": "a1"
}

由于目前它仅participantId在获取Asset详细信息时才返回,有没有办法获取参与者的详细信息以及AssetJSON 响应?

4

2 回答 2

3

如果您指定一个名为的过滤器键include并将值设置为,resolve则关系将被解析并且相关资产也将被返回。

于 2017-06-15T20:00:14.977 回答
1

以示例改进已接受的答案 -

1. 'http://localhost:3000/api/PurchaseOrder?filter={"where":{"orderId":"A01"},"include":"resolve"}'

2. 'http://localhost:3000/api/PurchaseOrder?filter={"include":"resolve"}'
于 2018-08-25T10:00:17.390 回答