kevinswiber / siren

Structured Interface for Representing Entities, super-rad hypermedia
MIT License
1.3k stars 71 forks source link

Understanding the format: How to include addition info in collection response #86

Open pke opened 7 years ago

pke commented 7 years ago

Being new to siren I am struggling with the following scenario. I have a collection resource that returns a different result based on a query param: /items?code=FOOBAR

What would be the responses class and properties?

The response would contain the items but I'd like it to also include information about the code, especially when it is about to expire. Would the _links key the right place to put a rel: ["code"] in there that references the code resource where the client could get more info about the code? Could the collection response also already contain parts of the code resource, like the expireDate as inline properties?

Could the expireDate be part of the responses properties?

Thanks for helping out here.

jdougan commented 7 years ago

Have you seen issue https://github.com/kevinswiber/siren/issues/54 ?