Skip to content

Instantly share code, notes, and snippets.

@superstructor
Created June 11, 2013 06:47
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 superstructor/5754905 to your computer and use it in GitHub Desktop.
Save superstructor/5754905 to your computer and use it in GitHub Desktop.
Or for a coffee order maybe consider that the order and the payment could be independent resources, thus you get
{
"_links": {
"self": {
"href": "/api/orders/123"
},
"profile": {
"href": "/profiles/order"
}
"/rels/payments": {
"href": "/api/orders/123/payments",
"profile": "/profiles/order/payments"
}
}
}
{
"_links": {
"self": {
"href": "/api/orders/123/payments"
},
"profile": {
"href": "/profiles/order/payments"
},
"/rels/create-form": {
"href": "/forms/order/payment/create",
"profile": "/profiles/form"
},
"/rels/create": {
"href": "/api/orders/123/payments",
"profile": "/profiles/order/payment/create"
}
},
"_embedded": {
"payment": [
{
"_links": {
"self": {
"href": "/api/orders/123/payments/1001"
},
"profile": {
"href": "/profiles/order/payment"
}
},
"type": "credit-card",
"amount": "5.50",
"currency": "NZD",
"status": "declined",
"reason": "invalid card details"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment