Reputation: 123238
If a site has a resource at the path:
/things/27
Does any published standard indicate that the path:
/things
Should also, therefore, have a resource?
I've discussed this with a colleague, and coming from a Unix background (and remembering the old dys of file-structure based HTTP servers) my inclination was to answer yes, a parent resource is implied and the parent dir shouldn't 404.
However my colleague believed that unless there's a specific link to '/things' somewhere on the site, that no resource is required to be on this path.
Is this matter discussed in RFC2616 or other HTTP standards documents? Is there other relevant documentation on the topic?
Upvotes: 1
Views: 49
Reputation: 12680
If you're considering implementing hypermedia in your application to provide the client of a set of possible actions at a given point (links with URI's to other appropriate resources) then the /things
URI is the ideal place to send a GET for these links.
Below is a sample result of a GET on the /things
resource. The advantage of this approach is that the client can be coded to look for the Rel
values in the Links
instead having to "know" how to construct the URI's. Even when client does need to build to a URI, it can still coded for search for items like {searchTerm}
in the Search link href to replace with an appropriate value.
"Things": [
{
"Description": "Resource level properties that make sense to put here",
"Count": 33,
"Links": [
{
"Rel": "self",
"Method": "GET",
"Href": "http://yourDomain/things",
"Title": "Things resource"
}
]
}
],
"Navigation": [
{
"Links": [
{
"Rel": "GetItem",
"Method": "GET",
"Href": "http://yourDomain/things/{id}",
"Title": "Get a single item"
},
{
"Rel": "Search",
"Method": "GET",
"Href": "http://yourDomain/things/?searchTerm={searchTerm}&itemsPerCall={itemsPerCall}",
"Title": "Search items per term"
}
]
}
]
Upvotes: 1