Skip to content

Instantly share code, notes, and snippets.

@pbuzulan
Last active March 5, 2020 21:29
Show Gist options
  • Save pbuzulan/9f314f0d2772122f0365d2588b97b503 to your computer and use it in GitHub Desktop.
Save pbuzulan/9f314f0d2772122f0365d2588b97b503 to your computer and use it in GitHub Desktop.
HATEOAS Implementation Examples
{
"id": 123,
"page_count": 416,
"status": "PUBLISHED",
"links": [
{
"rel": "author",
"href": "https://localhost/authors/3",
"action": "GET",
"types": [
"application/json"
]
},
{
"rel": "author",
"href": "https://localhost/authors/3",
"action": "PUT",
"types": [
"application/json"
]
},
{
"rel": "self",
"href": "https://localhost/authors/3",
"action": "GET",
"types": [
"application/json"
]
},
{
"rel": "self",
"href": "https://localhost/books/123",
"action": "PUT",
"types": [
"application/json"
]
},
{
"rel": "self",
"href": "https://localhost/books/123",
"action": "PATH",
"types": [
"application/json"
]
},
{
"rel": "self",
"href": "https://localhost/books/123",
"action": "DELETE",
"types": [
]
}
]
}
{
"id": 123,
"page_count": 416,
"status": "PUBLISHED",
"authors": [
{
"rel": "author",
"href": "https://localhost/authors/3",
"action": "GET",
"types": [
"application/json"
]
},
{
"rel": "author",
"href": "https://localhost/authors/3",
"action": "PUT",
"types": [
"application/json"
]
}
],
"self": [
{
"rel": "self",
"href": "https://localhost/authors/3",
"action": "GET",
"types": [
"application/json"
]
},
{
"rel": "self",
"href": "https://localhost/books/123",
"action": "PUT",
"types": [
"application/json"
]
},
{
"rel": "self",
"href": "https://localhost/books/123",
"action": "PATH",
"types": [
"application/json"
]
},
{
"rel": "self",
"href": "https://localhost/books/123",
"action": "DELETE",
"types": [
]
}
]
}
{
"id": 123,
"page_count": 416,
"status": "PUBLISHED",
"authors": [
"https://localhost/authors/3"
],
"self": "https://localhost/books/123",
"categories": [
"https://localhost/categories/25",
"https://localhost/categories/37"
]
}
{
"id": 1,
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
"repository_url": "https://api.github.com/repos/octocat/Hello-World",
"Labels_url": "https://api.github.com/repos/octocat/Hello-World/is sues/1347/labels{/name}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
"events_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/events",
"html_url": "https://github.com/octocat/Hello-World/issues/1347",
"number": 1347,
"state": "open",
"title": "Found a bug",
"body": "I’m having a problem with this.",
"user": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"labels": [
{
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
"name": "bug",
"color": "f29513"
}
],
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment