"Plain JSON" vs Hydra

Hi,

Following some discussions here about Hypermedia API's, I'm struggling with some design decisions. First let me make something clear: I really like JSON-LD and I really like Hydra.

However, in my opinion, JSON-LD is just another response format. In our API's we've dropped XML support some years ago (fortunately), and provide only JSON. Now i know that JSON-LD is basically (completely valid) JSON, but still I'd like to provide both "Plain JSON" and JSON-LD responses.

That said, if someone sends the accept header application/json, I won't bother him/her with @types, external links and @context values. If someone sends the accept header application/ld+json, I return a JSON-LD document, with more than 'just' a link to a context file in the response header so that it actually makes a lot of sense to use this representation.

On top of that, I also like the idea of providing support for application/nquads responses. This way I am able to load data into a triplestore by just importing the URL (of the collection) with accept header application/nquads.

When implementing Hydra, there is no alternative to 'explore' your API in the "normal" application/json response. I could implement something like HAL for that response I guess, but then I'd have to do both. My guess is that the majority of the people on this list like to only provide a application/ld+json response instead of both.

I'm not saying that's wrong, I'd just like to know your opinions on this ;-)

Kind regards,

Dimitri 		 	   		  

Received on Tuesday, 5 August 2014 15:23:22 UTC