Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views12 pages

S4 Slides

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 12

What is REST?

Memi Lavi
www.memilavi.com
REST :

REpresentational State Transfer


REST :

REpresentational State Transfer

REST API enables transfer of representation

of a resource’s state
REST Request / Response
State:
- The current resource properties
- Result of an action on the resource
Request for resource’s state
Order no. 17

Client Server
Order no. 17 representation
Response with the resource’s state
representation
REST Request / Response

Request to delete a resource


Order no. 17

Client Server
Resource deleted
Response with the resource’s state
representation
REST Request / Response over HTTP

Request for resource’s state


Order no. 17

Client Server
Order no. 17 representation
Response with the resource’s state
representation
REST Request / Response over HTTP

Request for resource’s state


GET /api/order/17

Client Server
200 OK, JSON
Response with the resource’s state
representation
Structure of REST API Request

Method HTTP Verb (GET, POST, PUT, DELETE…)

URL Location of the resource + parameters

Headers Meta-data of the request (User Agent…)

Body Contents of the request (optional)


Structure of REST API Request
URL
Method

Headers
Structure of REST API Response

Status Code 200 (Success), 404 (Not Found), etc…

Headers Meta-data of the response (Content Type…)

Body Contents of the response (optional)


Structure of REST API Response

Status

Headers

Body
Response Types

• Usually JSON

• Can be also XML or HTML

• Rarely used

You might also like