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"
}
]
}
]