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

Interesting. But it has one flaw; how exactly would I do this

curl https://api.twilio.com/2010-04-01/Accounts -H "Accept: application/json

inside a browser on a normal GET request?



The short answer is that browser vendors need to get their act together. They've shirked this because no-one's demanded it.

Fortunately until they do, broadly, a browser user will always want the newest resource, and the type can usually be defaulted (you're using a browser, so you want HTML by default where available). Additionally, XHR and related technologies usually allow adding custom headers.


One way I have solved this issue is to look for the Accept header. If no valid formatting options are available in the Accept header look for a query string parameter.

To me this is vital. Being able to explore an api within an browser makes it exponentially easier to understand and use.


Why would you want to do that from a browser?


Ummm... why wouldn't you? Rich web clients and all that?


I thought he meant doing it manually. Using XHR is trivial isn't it?




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

Search: