Skip to content

Instantly share code, notes, and snippets.

@hjr3
hjr3 / e-commerce.md
Created April 3, 2012 05:35
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links

@kevinswiber
kevinswiber / hal.json
Created July 7, 2012 14:56
JSON Siren vs. HAL Representations
{
"_links": {
"self": { "href": "/orders" },
"next": { "href": "/orders?page=2" },
"find": { "href": "/orders{?id}", "templated": true }
},
"_embedded": {
"orders": [{
"_links": {
"self": { "href": "/orders/123" },
{
"_links":{
"self":{
"href":"/users"
}
},
"_forms":{
"create-user":{
"title":"Create a new widget",
"description":"Enter your widget info and submit to create a new widget",
@dschulten
dschulten / gist:5696110
Last active December 18, 2015 00:19
Possible HAL equivalent to forms
// HAL "form" for single-item-resource. Clients must query OPTIONS for /account
// to ensure they can PUT, POST, DELETE, GET. The profile attribute contains a json-schema
// which can also be requested in other media types from /rels/account.
{
"userName": "Fred",
"realName": "Fred Flintstone",
"password": "yabbadabba",
"_links": {
"self": {