If I was working on a web application designing and writing an API how does that differ from a general web application development?
What things would I need to consider and take into account? Are there any standard processes to follow when creating an API that could be used by thousands of clients?
0
It depends.
In a recent project, I made the web application and the API nearly identical. If you had http://example.com/some/action/here used by the web application as a page or through AJAX, the same request with the same URI would also be used through the API, only served with different MIME types (HTML or JSON type for the web application, JSON or XML for the API).
It works, and has its huge advantage: you write the code once. At least for the most part of the codebase, since there would be discrepancies. For example, it wouldn’t make sense to use CAPTCHA in your API; on the other hand, the API would probably have a few additional calls that are not used by the web application.
You may as well designate the API in a very different way, distinct from your web application. This gives you for example the opportunity to have a RESTful API, while the web application would use sessions.
You could, for instance, have a web application that is entirely client side, and therefor does not require an API. One particular gotcha, is that browsers will limit you to only initiate HTTP GETs or POSTs, where as a RESTful API, for instance, may additionally require HTTP PUTs and DELETEs. As an example, the Ruby on Rails framework has a piece of Rack middleware that translates HTTP POSTs with a _method=[PUT|DELETE] parameter to the corresponding PUT|DELETE API call.