RESTful API Design: support multiple formats
Let's continue our discussion on pragmatic REST API design by exploring formats.
Should you support only one format or multiple formats?
I recommend that you support more than one format - that you push things out in one format and accept as many formats as necessary. You can usually automate the mapping from format to format.
Here's what the syntax looks like for a few key APIs
* the type argument, if present, overrides the Accept header
Digg allows you to specify in two ways: in a pure RESTful way in the Accept header or in the type parameter in the URL. This can be confusing - at the very least you need to document what to do if there are conflicts.
I recommend the Foursquare approach
To get the JSON format from a collection or specific element.
Developers and even casual users of any file system are familiar to this dot notation. It also requires just one additional character (the period) to get the point across.
What about defaults?