2017-06-15 59 views
1

我們定義的資產爲:composer-rest-server REST API是否返回json響應中的嵌套對象?

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 SupplierChainParticipant identified by participantId { 

o String participantId 

o String identity 

o String type 
} 

現在,當我使用的作曲家,其餘服務器的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" 

} 

作爲目前唯一返回的參數只有在獲取資產細節時,是否有辦法將參與者的細節與資產一起作爲Json r esponse?

回答

1

如果您指定一個名爲include的過濾器密鑰並將值設置爲resolve那麼關係將被解析並且相關資產也將被返回。

+0

作爲請求的一部分,我需要添加一個名爲「include」的字段並將其值設爲「resolve」? –

+0

謝謝你丹:) –