我们已将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
as:
participant SupplierChainParticipant identified by participantId {
o String participantId
o String identity
o String type
}
现在,当我使用composer-rest-server的REST API获取Asset
详细信息时,我会收到以下响应:
{
"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
,是否有办法获取参与者的详细信息以及Asset
作为JSON响应?
答案 0 :(得分:3)
如果您指定名为resolve
的过滤器密钥并将值设置为not exists
,则会解析关系,并且还会返回相关资产。
答案 1 :(得分:1)
通过示例改善接受的答案-
1. 'http://localhost:3000/api/PurchaseOrder?filter={"where":{"orderId":"A01"},"include":"resolve"}'
2. 'http://localhost:3000/api/PurchaseOrder?filter={"include":"resolve"}'