Skip to content

Instantly share code, notes, and snippets.

@morganney
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save morganney/9079649 to your computer and use it in GitHub Desktop.

Select an option

Save morganney/9079649 to your computer and use it in GitHub Desktop.
Hypertext structure for the restbus API resource "_links".
{
// ... some resource's JSON representation ...
_links: {
/**
* EVERY resource links to its own canonical representation which may
* or may not be located at the current context URI, i.e. depending on
* the current context, an actual state transition might or might not
* occur when dereferencing the link.
*/
self: {},
/**
* A resource MIGHT link to one or more resources along the current URI
* path. Following these links ALWAYS constitues a state transition from
* the current context. This is how clients 'discover' other resources
* as they move 'forward' along the URI path.
*/
to: [],
/**
* A resource MIGHT be linked from one or more other resources (endpoints).
* These are other endpoints (URI's) where the current context resource
* is either contained (collections) or obtained by dereferencing links in
* the target context. Note, these links are NOT NECESARRILY A PREFIX of the
* context URI. Following these links MIGHT constitute a state transition.
*/
from: []
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment