HATEOAS link relations from filtered to unfiltered collections

59 views
Skip to first unread message

David Biesack

unread,
Feb 10, 2015, 1:00:41 PM2/10/15
to api-...@googlegroups.com
Say an API has a collection of models that allows filtering/sorting

  GET .../models?filter=some-filter?sortBy=field1:ascending,field2:descending

and the response contains a set of link relations for paginating, such as the following Atom links:

 { "rel" : "first", .... }.
 { "rel" : "prev", ... },
 { "rel" : "next", ... },

What do people suggest for the link relation that returns to the unfiltered list (with default sort)?

There might be a generic, reusable link relation that would apply to all collections:
 { "rel" : "all", .... }
or
 { "rel" : "collections", ... }

or I could go with a resource-specific link relation, i.e. in this case

 { "rel" : "models", ... }

Suggestions? I've tried to identify APIs that use such link relations, but I'm not having much luck.
(references welcome)

thanks,
djb

darrel...@gmail.com

unread,
Feb 10, 2015, 2:25:14 PM2/10/15
to api-...@googlegroups.com
You could use the new “derivedfrom” relation.  http://www.iana.org/assignments/link-relations/link-relations.xml


Darrel
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages