I'm working on a draft spec for version 2 of the Pinboard API, and one
thing I'd like to hear is which APIs developers on this list have
found an absolute pleasure to use. I want to make sure I steal the
best ideas.
Please do not send me links to any kind of 'best practices' rant about
RESTful API design. Rather, I'd like specific examples of existing
APIs. If you can take some time to explain what about them makes you
happy, all the better.
- Authentication is simple- Formats are json or xml
- Use of URL parameters for things that would go nicely in URL, i.e. room_id, date and format.
https://api.hipchat.com/v1/rooms/history/12345/2012-02-01.json?auth_token=asdefasdefasdefasdef
- When they used nouns in URLs well.
- When they use verbs in URLs:
https://www.hipchat.com/docs/api/method/users/createhttps://www.hipchat.com/docs/api/method/users/deletehttps://www.hipchat.com/docs/api/method/users/show
Also, as for my suggested URL format, let me change that to:Would be better if they used "/users/new" for "/users/create", HTTP DELETE to"/users/{user_id}" instead of "/users/delete?user_id={user_id}", "/rooms/{room_id}" instead of "/rooms/show", and HTTP PUT to "/users/{user_id}" instead of "/users/update?user_id={user_id}."
--
You received this message because you are subscribed to the Google Groups "Pinboard" group.
To post to this group, send email to pinboa...@googlegroups.com.
To unsubscribe from this group, send email to pinboard-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pinboard-dev?hl=en.
* Mike Schinkel <mikesc...@newclarity.net> [2012-02-08 01:50]:
> https://www.hipchat.com/docs/api/method/rooms/create
> https://www.hipchat.com/docs/api/method/rooms/delete
> https://www.hipchat.com/docs/api/method/rooms/show
> https://www.hipchat.com/docs/api/method/users/create
> https://www.hipchat.com/docs/api/method/users/delete
> https://www.hipchat.com/docs/api/method/users/show
> https://www.hipchat.com/docs/api/method/users/update
>
> Would be better if they used "/users/new" for "/users/create", HTTP
> DELETE to "/users/{user_id}" instead of
> "/users/delete?user_id={user_id}", "/rooms/{room_id}" instead of
> "/rooms/show", and HTTP PUT to "/users/{user_id}" instead of
> "/users/update?user_id={user_id}."
I would find this even nicer to use:
POST https://api.hipchat.com/v1/users → Create user, returns 303
GET https://api.hipchat.com/v1/users/{user_id} → Get user details
PUT https://api.hipchat.com/v1/users/{user_id} → Update user details
DELETE https://api.hipchat.com/v1/users/{user_id} → Delete user
(But note that PUT is not for partial updates. It has to include the
entire new state of the resource.)
This isn’t even REST, it’s just basic HTTP. (REST is a step beyond – it
means including links to any relevant other parts of the API inside the
responses it returns.)
Maciej: for non-GET/POST methods it’s useful to support accepting them
as POST with a X-HTTP-Method-Override request header or with a special
form parameter that gives the desired actual method to use – so people
who have to use crippled HTTP clients (which includes HTML forms…) or
intermediaries are not locked out.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
I would find this even nicer to use:
POST https://api.hipchat.com/v1/users → Create user, returns 303
GET https://api.hipchat.com/v1/users/{user_id} → Get user details
PUT https://api.hipchat.com/v1/users/{user_id} → Update user details
DELETE https://api.hipchat.com/v1/users/{user_id} → Delete user
(But note that PUT is not for partial updates. It has to include the
entire new state of the resource.)
I like yours even better. ANd I respect your opinion on all things REST. (Not sure if you remember me but I spend time on the rest-discuss list in 2006 and 2007.)
This isn’t even REST, it’s just basic HTTP. (REST is a step beyond – it
means including links to any relevant other parts of the API inside the
responses it returns.)
Of course.
Maciej: for non-GET/POST methods it’s useful to support accepting themas POST with a X-HTTP-Method-Override request header or with a special
form parameter that gives the desired actual method to use – so people
who have to use crippled HTTP clients (which includes HTML forms…) or
intermediaries are not locked out.
@Maciej: I'll give Aristotle 2 thumbs up for REST APIs, he's been focused on REST for years so he know of what he speaks and you are lucky to have him as a user/developer.