The Sun Cloud API at http://kenai.com/projects/suncloudapis/pages/Home is a good example for a RESTful API. True for RESTful principles, when you access a resource, you get more or less than representing that resource.
The Content-Type header in the response tells you what the type of this resource is, for example application / vnd.com.sun.cloud.Snapshot + json. The sun recorded these mimetics using IANA.
How practical is this overall at the moment? Most of the APIs I've seen used the Content-Type "application / json". This suggests that the answer is JSON, but nothing more. You must have something in the JSON object as a type property in order to know what it is.
I am developing a RESTful API (which will not be published, so I will not register mimetypes). I used RESTEasy, and I believe that even if I specify the full mimetype type, the Content-Type in the response header will be exactly what the Accept request header says. If the request requests "application / * + json" by default, the response header will have "application / * + json". Perhaps I will fix this by changing the title before the answer goes blank, but should I try to do this? Or should the answer have a wildcard, like a request?
Or do I just need to maintain "application / json", as most APIs do?
Additional thoughts added later:
: HTTP HTTP ?
HTTP , ( ), "Content-Type" "" .
HTTP , "" 200 OK, " " - , "application/json" , , , , , . RESTful, RESTful. (HTTP - RESTful, ).
. HTTP , , ; , "401 Unauthorized" , .