"actions": [ { "name": "add-item", "title": "Add Item", "method": "POST", "href": "http://api.x.io/orders/42/items", "type": { "application/x-www-form-urlencoded": [ { "name": "orderNumber", "type": "hidden", "value": "42" }, { "name": "productCode", "type": "text" }, { "name": "quantity", "type": "number" } ], "application/json": { "type": "object", "properties": { "orderNumber": { "type": "number" }, "productCode": { "type": "string" }, "quantity": { "type": "number"}, } } } } ],
"actions": [ { "name": "add-item", "title": "Add Item", "method": "POST", "href": "http://api.x.io/orders/42/items", "type": {
"application/x-www-form-urlencoded": "/link/to/html5ish/field/data", "application/json": "/link/to/json-schema" } } ],
To view this discussion on the web visit https://groups.google.com/d/msgid/siren-hypermedia/cb10377b-974a-4ba7-9096-385f99b54b8e%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "Siren Hypermedia" group.
To unsubscribe from this group and stop receiving emails from it, send an email to siren-hypermed...@googlegroups.com.
To post to this group, send email to siren-hy...@googlegroups.com.
Old thread but
anyway:
I am currently using this approach in my project:
"actions": [
{
"name": "CustomerMove",
"title": "A Customer moved to a new location.",
"method": "POST",
"href": "http://myapi/Customers/1/Move",
"type": "application/json",
"fields": [
{
"name": "NewAddress",
"type": "application/json",
"class": ["http://myapi
/Customers/NewAddressType"]
}
]
},
...
],
I intend to tell the client that I expect a JSON object of type NewAddressType. The class link provides a JSON schema generated on the server. So a client can resolve it at run time and generate a schema conform UI or validate against it.
This can also be used to generate or validate objects at compile time by talking to implemented server or a mock server (e.g.blueprint + drakov).