Restful (Representational State Transfer) API
July 29, 2015
What is a RESTFUL API?
An API, or application programming interface, is kind of like a coding contract: it specifies the ways a program can interact with an application. For example, if you want to write a program that reads and analyzes data from Twitter, you'd need to use the Twitter API, which would specify the process for authentication, important URLs, classes, methods, and so on. For an API or web service to be RESTful, it must do the following:
Making XML HTTP Request
The Four Verbs
- GET: retrieves information from the specified source (you just saw this one!)
- POST: sends new information to the specified source.
- PUT (or PATCH): updates existing information of the specified source.
- DELETE: removes existing information from the specified source.
The Response Status Codes
A Successful request to the server results in a response, which is the message the server sends back to you, the client.
There are various status code but most important status is '200' status, which is okay. The most famous is '404' which is file not found. More detailed information about the status does are here
HTTP Response structure mirrors that of the HTTP request. It contains, HTTP status code, a header and the body.