Search code examples
resthypermedia

REST - share URI templates in Hypermedia with large data sets?


I'm building a REST application that intends to be fully hypermedia drive. Consumers of the service will hit an entry point and from then on will follow links. However, I've got a massive list of child resources for a parent - e.g. orders/1 orders/2 ... orders/5000000000

It's very difficult to provide efficient navigation for this, because clients may have to make hundreds of requests. I'm thinking a URI template is the way to go. Is it recommended? Is it RESTful? How do I present URI templates in a standard way that will be understood by others?


Solution

  • URI templates are certainly REST - they are simply semi-advanced hypermedia controls. Hypermedia can be more than just links - think of forms in HTML which are hypermedia controls for either GET/POST requests and their payloads.

    How do I present URI templates in a standard way that will be understood by others?

    You can use one of the hypermedia enabled media types. For instance Mason or Siren to mention a few.