Many newer application programmers are realizing the need to open their core functionality to a greater audience. Providing easy, unfettered access to your core API can help get your platform accepted, and allows for mashups and easy integration with other systems.
→ REST is the underlying architectural principle of the web and depends on HTTP headers for direction.
→ HTTP is oriented around verbs and resources. GET, POST(most commonly used)
→ To modify and remove, PUT and DELETE used respectively.
Basic Authentication level: Security and data binding is the most pririty when you are creating APIs. Here are some basic points needed to be check:
→ SSL support, https
→ Check the request type, request source, browser, device
→ It may have a key/device id to check that the request made from a registered device
Followings are the example API URI,
URL
|HTTP Method
|Operation
/api/user/3 |
GET
|Returns a JSON object containing some information for a user
/api/add | POST
| Adds new user data to be stored in server
API request and response : To get a detailed information about a specific user, followings are the example request and response in JSON format to be parsed and used.
Request
GET /user/3
Accept: application/json
Response
200 OK
Content-Type: application/json
{
"user": {
"id": 3,
"name": "Jack",
"country": "Austria",
}
}