Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The main reason people don't want to put the output format into the URL is that URLs are supposed to represent canonical consumer-independent foreign keys in REST.

If you want to put the output format into the URL, I like the .json .xml extensions better. Not that there's anything wrong with the request parameter approach, but the file extension approach also plays nice with user OSes.

Also, I'd ideally use both approaches. So the consumer can pick between using /resouce/1 with an Accept header, or just using /resource/1.xml /resource/1.json directly. The nice thing about the Accept header is that file extensions can have some ambiguity whereas the MIME types are pretty standard and come with RFCs backing them up.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: