Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommendations for writing an API

I'm about to write an api and thought I'd find some good recommendations on things to look out for, how to write a good api.

I of course did a google search, but aside from this from Dustin Diaz http://www.dustindiaz.com/api-writing-tips/, I haven't really been able to find good recommendations.

What are things that you wish you had done differently when creating an API? What made the biggest difference.

I assuming I'm going to use oauth.

I'm purposely not providing details of the api, as I'm looking for more general recommendations that will hopefully be useful to a larger number of people.

like image 423
pedalpete Avatar asked Jun 28 '11 00:06

pedalpete


People also ask

What makes a successful API?

A good API thinks through its developer experience, providing complete, accurate, and easy-to-digest documentation. It also helps its developers by thinking through common use cases, the sort of things the real user of the API will want.

What are some qualities of a well designed API?

A well-designed API is simple, clean, clear and approachable for its consumers. Why? Because in general, API consumers prefer APIs with these characteristics.


1 Answers

Key points I would recommend you look at:

  • Implement a RESTful interface
  • Offer a variety of data formats (JSON, XML, etc)
  • Make the syntax intuitive and easy to understand
  • Thorough documentation
  • Use proper response codes

Also, here are some links you may find useful:

http://www.slideshare.net/eaton/building-apis-that-rock
http://www.notiondesign.ca/blog/story/how-not-to-build-an-api/
http://blog.apigee.com/category/api_best_practices/
http://blog.isnotworking.com/2007/05/api-design-guidelines.html

Also, this is a great book that may help you get started:

http://www.amazon.com/dp/0596529260/

like image 159
Swift Avatar answered Nov 08 '22 21:11

Swift