Reputation: 701
We have defined Asset
as:
asset PurchaseOrder identified by orderId {
o String orderId
--> SupplierChainParticipant createdBy
--> SupplierChainParticipant assignedTo
o String description
o String status
o Integer quantity
o String assetId
}
and Participant
as :
participant SupplierChainParticipant identified by participantId {
o String participantId
o String identity
o String type
}
Now When I am fetching Asset
details using REST API of composer-rest-server, I receive response as:
{
"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"
}
As currently its only returning participantId
only while fetching Asset
details, Is there a way to fetch details of participant along with Asset
as JSON response?
Upvotes: 4
Views: 477
Reputation: 9537
To improve upon the accepted answer with example -
1. 'http://localhost:3000/api/PurchaseOrder?filter={"where":{"orderId":"A01"},"include":"resolve"}'
2. 'http://localhost:3000/api/PurchaseOrder?filter={"include":"resolve"}'
Upvotes: 1
Reputation: 2297
If you specify a filter key called include
and set the value to resolve
then relationships will be resolved and the related assets will also be returned.
Upvotes: 3