Siren example from: https://github.com/kevinswiber/siren#actions-1
{
"class": ["order"],
"properties": {"orderNumber": 42, "itemCount": 3, "status": "pending"},
"entities": [
{
"class": ["items", "collection"],
"rel": ["http://x.io/rels/order-items"],
"href": "http://api.x.io/orders/42/items"
},
{
"class": ["info", "customer"],
"rel": ["http://x.io/rels/customer"],
"properties": {"customerId": "pj123", "name": "Peter Joseph"},
"links": [{"rel": ["self"], "href": "http://api.x.io/customers/pj123"}]
}
],
"actions": [
{
"name": "add-item",
"title": "Add Item",
"method": "POST",
"href": "http://api.x.io/orders/42/items",
"type": "application/x-www-form-urlencoded",
"fields": [
{"name": "orderNumber", "type": "hidden", "value": "42"},
{"name": "productCode", "type": "text"},
{"name": "quantity", "type": "number"}
]
}
],
"links": [
{"rel": ["self"], "href": "http://api.x.io/orders/42"},
{"rel": ["previous"], "href": "http://api.x.io/orders/41"},
{"rel": ["next"], "href": "http://api.x.io/orders/43"}
]
}
{
"head": {
"curies": {
"siren-actions": "https://github.com/kevinswiber/siren?fake-action="
}
},
"h:ref": {
"self": "http://api.x.io/orders/42",
"previous": "http://api.x.io/orders/41",
"next": "http://api.x.io/orders/43"
},
"h:link": [
{
"rel": ["siren-actions:add-item"],
"uri": "http://api.x.io/orders/42/items",
"action": "append",
"contentType": "application/x-www-form-urlencoded",
"fields": {
"orderNumber": {"type": "hidden", "default": "42"},
"productCode": {},
"quantity": {"type": "number"}
}
}
],
"orderNumber": 42,
"itemCount": 3,
"status": "pending",
"items": [
{
"h:type": ["items", "collection"],
"h:ref": {
"http://x.io/rels/order-items": "http://api.x.io/orders/42/items"
}
},
{
"customerId": "pj123",
"name": "Peter Joseph",
"h:type": ["info", "customer"],
"h:ref": {"self": "http://api.x.io/customers/pj123"}
}
]
}