This topic contains 2 replies, has 1 voice, and was last updated by adamlundrigan 7 years, 9 months ago.
- Topic
I’m using the JSON-API to retrieve custom entities:
1234GET /api/courseofferings?filter[status]=A,C HTTP/1.1Authorization:WSSE profile="UsernameToken"X-WSSE: UsernameToken Username="xxxxxx", PasswordDigest="xxxxxx", Nonce="xxxxxx", Created="xxxxxx"Content-Type:application/vnd.api+jsonAnd I receive this response back from my application, as expected:
123456789101112131415161718192021222324252627282930313233{"data": [{"type": "courseofferings","id": "4","attributes": {"status": "A","createdAt": "2016-05-27T02:01:35Z","updatedAt": "2016-07-02T17:25:11Z"},"relationships": {"course": {"data": {"type": "courses","id": "1"}},"schedule": {"data": [{"type": "courseofferingtimes","id": "10"},{"type": "courseofferingtimes","id": "11"}]}}}]}Is there a way I can ask the API to return the whole serialized related entity instead of just the relationship link (type+id)? There are certain circumstances where I’d like to batch together all the related data so I can get it in one request.
In the above example, for instance, I would presently need to do three API calls to render the schedule for this Course Offering (one to fetch the offering itself, two more to fetch each schedule entry of type “courseofferingtimes”)
(Technically I could do it in two calls by doing /api/courseofferingtimes?filter[id]=10,11 instead of separate calls to /api/courseofferingtimes/10 and /api/courseofferingtimes/11 — but that’s still two total calls where I’d like to do one)
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.