Sunday, 18 August 2013

REST resources with a triple as a parameter

REST resources with a triple as a parameter

When needing to create a URL that takes a finite set of parameters, where
all of said parameters are semantically the same "level", what is the
current consensus around the use of delimiters within URLs? Here's an
example:
/myresource/thing1,thing2,thing3
/myresource/thing2,thing1
/myresource/thing1;thing2;thing3
/myresource/thing1;thing3
That is to say, the parameter here could be a single, a pair or a triple.
They can be specified in any order because they are not a logical tree,
and thing2 is not a subordinate resource of thing1, so doing something
like this seems "wrong":
/myresources/thing1/thing2/thing3
This bothers me because it implies a tree-like relationship between the
elements of the triple, and that is not the case (despite many HTTP
frameworks seemingly pushing this, wrongly in my view). In addition, using
a query string doesn't feel right as this is not a search operation, it is
a known triple in a very finite space - there's nothing to query or
search, so to speak.
I suppose the other option would be to make it a POST request and supply a
body that details the parts of the triple being supplied. This doesn't
give me warm fuzzies though, for some reason.
How have others handled this? Delimiters seem clean to me, and communicate
the intended semantics of the resource, but i know there are folks would
would take a different view, and I was looking to understand the
experiences of others who've had similar use cases.

No comments:

Post a Comment