"JSON doesn’t have links."
JSON doesn't, but HTTP does. Why not use Link headers?
JSON doesn't, but HTTP does. Why not use Link headers?
Link relations are useful for adding links to media types that can't support links (e.g. images, etc), and for layering protocols (e.g. Linked Cache Invalidation), but for normal APIs it makes your clients life much easier if you just put them in the body.
OPTIONS /orders
{
"GET": {
"description": "All the orders."
"links": {
"self": { "href": "/orders" },
"next": { "href": "/orders?page=2" },
"find": { "href": "/orders{?id}", "templated": true },
"admin": [
{ "href": "/admins/2", "title": "Fred" },
{ "href": "/admins/5", "title": "Kate" }
]
}
}
}