Skip to content

Instantly share code, notes, and snippets.

@chenghung
Last active July 4, 2019 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chenghung/1c45ec95e2d7b49ad1a64fa2f9d77eff to your computer and use it in GitHub Desktop.
Save chenghung/1c45ec95e2d7b49ad1a64fa2f9d77eff to your computer and use it in GitHub Desktop.
rest api discuss
POST /orders
{
id: 5,
state: 'payment-expected',
_links: {
self: {
method: 'GET',
href: '/orders/5',
}
payment: {
method: 'PUT',
href: '/orders/5/payments',
},
change: {
method: 'PUT',
href: '/orders/5/changes',
}
cancel: {
method: 'PUT',
href: '/orders/5/cancels',
}
}
}
GET /orders/:id // refresh
PUT /order/:id/changes
{
id: 5,
state: 'unpaid',
_links: {
self: {
method: 'GET',
href: '/orders/5',
}
payment: {
method: 'PUT',
href: '/orders/5/payments',
},
change: {
method: 'PUT',
href: '/orders/5/changes',
}
cancel: {
method: 'PUT',
href: '/orders/5/cancels',
}
}
}
PUT /orders/:id/payments
{
id: 5,
state: 'paid',
_links: {
self: {
method: 'GET',
href: '/orders/5',
}
take: {
method: 'PUT',
href: '/orders/5/takes',
}
}
}
PUT /orders/:id/cancels
{
id: 5,
state: 'canceled',
_links: {
self: {
method: 'GET',
href: '/orders/5',
}
}
}
PUT /orders/:id/takes
{
id: 5,
state: 'completed',
_links: {
self: {
method: 'GET',
href: '/orders/5',
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment