w3c-api icon indicating copy to clipboard operation
w3c-api copied to clipboard

Honour “embed” param also for single objects (?)

Open tripu opened this issue 9 years ago • 3 comments

@vivienlacourba said:

Routes that return a collection of objects accept an ?embed=1 parameter which embeds the object instead of simply link to it.

Would it be reasonable that the embed parameter is honoured also when the request returns one object in particular? ie, apart from including a property _links in the result, include also _embed with that same object, in detail. That would save many subsequent calls in some cases.

This is my scenario: a dynamic page for a group typically calls the API 8 times: once for the group itself, then once again for each of {chairs, services, specifications, teamcontacts, users, charters, participations}. That is necessary because the information returned by the first request is rather succinct [append API key], and the embed parameter has no effect there. If embed worked there and Unitas could get basic info about those objects (name/title and href would suffice) on its first call, it would work much faster and save the rest of calls.

This would allow us to solve w3c/Unitas#3.

tripu avatar Mar 25 '16 11:03 tripu

(I think @vivienlacourba told me that yes, it's reasonable, but not a trivial feature to add.)

tripu avatar Apr 28 '16 13:04 tripu

Any idea if/when this could be tackled…?

tripu avatar Jul 11 '16 08:07 tripu

https://api-platform.com/ to the rescue…?

tripu avatar Dec 04 '17 16:12 tripu