Hi there,
my friends and I, we have come up with a new json hypermedia type inspired by collection+json and yet somewhat different. Or as I prefer to say: we turned collection+json upside down.
I would love to hear your honest opinion on four fields:
1. what's your "user experience"? Do you find it comprehensible and simple [1]?
2. do you find it as expressive as collection+json or hal is?
3. would you find it useful in other domains then mobile applications?
4. do you find any risks of using this hypermedia type?
5. have you seen/conceived similar hypermedia type?
Instead of providing a detailed protocol description (which is work in progress anyway) I'd like to share a thought or two and point to an example.
Please, find the thoughts below and the example here: [2].
And now to the hypermedia type itself.
One of the key requirements is (of course) that the client's experience is smooth or that he can't notice that the data is being fetched from server.
Therefore, we thought at first we would use collection+json and enhance it a little bit: we wanted to add a "prefetched" field to each "link" object (example: [3]).
That seemed fine at first but the hypermedia type got uglified. It also "feeled" not right somehow. So we finally came up with a completely different solution (example: [2]). The final outcome is that if one asks for a resource, say GET / then in the response he will get for example:
{
"href": "/",
"cache": {
"/": {
"collection": [ /* actual collection */ ],
"links": [
{
"rel": "accounts",
"href": "/accounts"
},
{
"rel": "users",
"href": "/users"
}
]
},
"/users": {
"collection": [ /* actual collection */ ],
"links": [ /* links */ ]
}
}
}
The promise given to the API consumer is that if he asks for GET / and gets some additional resource in response (e.g. "/users") then the subsequent GET /users would yield exactly the same result.
[1] Please note: I know it might be hard to read at first but easy != simple
Please note: apiary serves here as a service mock so the data might and will be incosistent
Please note: this ain't exactly collection+json++ but is heavily inspired on it.