Thanks for the article!
Amy Morris-Clark

Hey Amy, thanks for your interest in APIs. RESTful APIs are those that conform with REST architectural style. REST is considered an underlying architectural principle of the web, and it’s safe to say RESTful APIs are the most common Web APIs. There are many rules to follow with REST, but here are several that first come to mind:

  1. REST uses 4 HTTP verbs to describe the type of each request:

GET (request record)
PUT (update record)
POST (create record)
DELETE (delete record)

The verbs help streamline communication, but are also an easy to follow standard. One of the side benefits is that you can use the same url for different purposes. For example, a POST and a GET request to the same url would be considered as two different types of requests. From the user’s perspective, when you type in url into your browser, that is a GET request, whereas submitting a form on a website would usually be a POST request.

2. REST is stateless, meaning all the information required to process a given request is contained within the request itself. The server doesn’t need to know of previous requests in order to process the current request. For example, if you are logged in on some website, the server will expect your client to send the authentication credentials with each request — that is the only way the server knows that you are still you across a series of requests.

As pointed out by Jonathan Boulanger in his comment, APIs don’t have to be RESTful. I totally agree. In fact, even on the Web, the data transfer doesn’t have to conform to all of the REST principles. REST is just a prevalent style that works well with HTTP protocol. APIs are much more than just Web APIs. Some examples of non-RESTful non-Web APIs from my post are with Object Oriented Design and APIs of software libraries, such as JQuery.

When I was googling to formulate this post, I found this great article on RESTful Web Services, hope it will help you learn more about the concept.

In regards to your other question, an API is an interface, and not a file. Think of it as a waiter in a restaurant (thanks Fawad Mohamed for the awesome youtube clip). The waiter would bring a different meal based on your request, and so will API respond differently based on the parameters and url of your request. API documentation would usually serve as the “menu” for developers. :-)