Once again, a lot of this comes from the code academy course on using the twitter api I’m working on, I’m rewriting it and adding my occasional comments to help with my understanding.
API stands for Application Programming Interface, and is like a coding contract, specifying the ways a program can interact with an application. So if you wanted to write a program that reads and analyzes data from Twitter, you’d have to use Twitter’s API. It specifies things such as the process for authentication, important URL’s, classes, methods, etc.
For an API (or any web service) to be considered RESTful, it must do the following.
- Separate the client from the server
- Not hold state between requests. This is confusing to me, but code academy defines it as: all the information necessary to respond to a client request is available in each individual request. No data, or state (which is like a page on a website) is held by the server from request to request. I think this makes sense. Otherwise, the server would need to keep track of that, and if a lot of people were using your API, you’d have a lot of work to do. This let’s a lot of people use it without you having to do anything.
- Use HTTP and HTTP methods (like GET, POST, DELETE and PUT). These are the “verbs” mentioned in my earlier API blog post.