Why use a REST API

REST interfaces have become popular in public APIs because of their inherent simplicity. An API can focus on available resources, with details regarding updating and deleting of each resource delegated to the appropriate HTTP method in predictable ways.

The purpose of implementing a REST API is not primarily to add functionality but to add structure. Because of the inherent similarity of all REST APIs (by virtue of their underlying HTTP structure), familiarity with any REST API brings familiarity with all of them. In many cases it is just as easy to implement to a REST design as it is to use a more ad hoc API design, while reaping the benefits that come with well-understood REST conventions.

Finally, the availability of return codes is another example of leveraging known semantics when building a useful API. Without a meaningful return code it becomes necessary to parse every response to find out whether it worked or not. In addition, most modern browsers and Web programming frameworks expect that specific HTTP error codes are set in the event of error and respond differently depending on the code. This is especially apparent in the case of AJAX requests, which are often handled differently by many modern Javascript frameworks depending on the status code returned from the server.