An introduction to RESTful Web API design, including HTTP request and response messaging and how they are used in the context of interaction between web or mobile apps and web services.
8. March 2017
REST - RESOURCES
A resource is an object with a type, associated data,
relationships to other resources, and a set of methods
that operate on it
15. March 2017
REST - IMPLEMENTATION
UNIFORM INTERFACE - URL SCHEME
Resource name car
Resource URI /cars
Resource URL https://www.example.com/cars
16. March 2017
REST - IMPLEMENTATION
UNIFORM INTERFACE - HTTP VERBS
Create POST
Read GET
Update PUT
Delete DELETE
17. March 2017
REST - IMPLEMENTATION
SECURITY
• Token based authentication
• Header
Authorization: Bearer taw0ws5Kjvelc9z0RCfyfNrVWEqyFBNv3vN53HWk
18. March 2017
REST - IMPLEMENTATION
RESPONSE - SUCCESS
200 OK
201 CREATED
202 ACCEPTED
204 NO CONTENT
206 PARTIAL CONTENT
19. March 2017
REST - IMPLEMENTATION
RESPONSE - CLIENT SIDE ERROR
400 BAD REQUEST
401 UNAUTHORIZED
403 FORBIDDEN
404 NOT FOUND
405 METHOD NOT ALLOWED
406 NOT ACCEPTABLE
20. March 2017
REST - IMPLEMENTATION
RESPONSE - SERVER SIDE ERROR
500 INTERNAL SERVER ERROR
503 SERVICE UNAVAILABLE
21. March 2017
REST - IMPLEMENTATION
CREATE A NEW RESOURCE
Method POST
URL https://api.example.com/cars
Body {“brand”:”IKCO”, “model”:”Pars”}
Response
201 CREATED {“id”: 1, “brand”: “IKCO”,
“model”: “Pars”}
22. March 2017
REST - IMPLEMENTATION
GET ALL RESOURCES
Method GET
URL https://api.example.com/cars
Response
200 OK
[{“id”: 1, “brand”: “IKCO”, “model”: “Pars”},
{“id”: 2, “brand”: “Saipa”, “model”: “Pride”}]
23. March 2017
REST - IMPLEMENTATION
GET A SPECIFIC RESOURCE
Method GET
URL https://api.example.com/cars/2
Response
200 OK
{“id”: 2, “brand”: “Saipa”, “model”: “Pride”}
24. March 2017
REST - IMPLEMENTATION
UPDATE A SPECIFIC RESOURCE
Method PUT
URL https://api.example.com/cars/2
Body {“brand”:”Saipa”, “model”:”141”}
Response
200 OK {“id”: 2, “brand”:”Saipa”,
“model”:”141”}
25. March 2017
REST - IMPLEMENTATIONUNIFORM INTERFACE - DELETE A SPECIFIC
RESOURCE
Method DELETE
URL https://api.example.com/cars/2
Response 200 OK
Application Programming Interface
a set of functions and procedures that allow the creation of applications which access the features or data of an operating system, application, or other service.
B2B: GIS + Navigation
Navigation business
from 1 to 2
GIS service provider business level services
Your web API provides customer level services
Single implementation of logic
Roy Fielding
Since 2008
No changes in the state, no storing of sessions,
multiple runs of a request bears the same result
Online book library
books
authors
publishers
Also mention simple Simple API keys, OAuth 1
OAuth 2 needs https