w3c / w3c-api

The W3C API
https://w3c.github.io/w3c-api/
214 stars 92 forks source link

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

Open tripu opened 8 years ago

tripu commented 8 years ago

@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 commented 8 years ago

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

tripu commented 8 years ago

Any idea if/when this could be tackled…?

tripu commented 6 years ago

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