0 ratings0% found this document useful (0 votes) 623 views6 pagesRest API Handwritten Notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
“TREST APT].
Rest Stands for REPRESENTATIONAL STATE TRANSFER
REST APIS OPERATE ON A SIMPE REGUEST/REEPONGE 5 ysTE™M
ole
Le) ~te000e —F
SERVER RETVENS A RESPONSE WITH
CLIENT CAN MAKE A REQvesT
‘ATTP METHODS AN HITPSTATOS CODE
USING
i
SE METHODS ARE!
axe - POPULAR HITP SrATUs CODE:
GET, PosT ,PuT, PATCH, DELETE, 02% ,403 , 404, 500 ETC.
HEAD, TRACE, OPTIONS, CONNECT. Oe ea
HITP REQUEST CONTAINS HTTP RESPONSE CONTAINS
oo sTATOS Cove rTP Retvon sé
HEADERS Body.
a METHOD HEADERS
Ww REST API CONSTRAINTS
ATIVE KeMeR CUNKED I
eo TELEGRWY- NOTES GALLERY
UNIFORM JAITERFACE
© FOLLOW A COMMON PROTOCOL
CLIENT- SERVER ARCHITECTURE
@ NO THIRD PARTY INTERPRETATION.
LAYERING
© MULTIPLE INTERMEDIARIES
Gerwieen CLIENT AND
SERVER,
STATELESSNESS
* THERE 18 NO STATE.
CLIENT AND SERVER ARE
COMPLETELY SEPARATED.
CACHEABILITY
RESPONSE CAN BE
CACHEABLE
Ue kumar CLIniedjadd.HITP HEADERS
CLIENT AND SERVER CAN PASS THE ExTRA BIT OF jNFoRmATION
WITH THE REQUEST AND RESPONSE USING HTTP HEADERS,
DIwiDeD INTO FOUR PARTS
REQUEST HEADERS RESPONSE HERDERS REPRESENTATION PAY LORD
* CLIENT TD SERVER, © SERVER TO CLIENT. HEapERs HEADERS
* INPORMATION ABOUT —« inspoemationl
THE BObY of THE AGour THE
RELA er PAYLOAD DATA.
Arue puma (LINKEDIN).
WIDELY USED HTTP HEADERS
Accept Content - TyPe
‘TYPE OF DATA CLIENT CAN SPECIFIES THE MEDIA TYPE OF
UNER STAND, THE RESOURCE.
Accept « Encoding Ht |
WHICH ENCODING METHOD CLIENT SPECIFIES THE DOMAIN
CAN UNDERSTAND, Name,
°
4utrosizatton Access - Control -
+
USED To PALS CREDENTIALS £0 4uiow - origin.
TAT Servers can WHICH ORIGIN 1$ ALLOWED To ACCESS
AUTHENTICATE. TAE RESOURCES,
Accept Access - Control -
- Language Allow - Methods.
CLIENT If EXPECTING THE RECPONSE WHIcH METHODS ARE AcLoWED
IN THE MENTIONED TO ACCESS THE CROES—
LANGUAGE ORIGN RESOURCES,
ATUL kumAg LLINKEDIN).|
|
HTTP STATUS Cope
Reaves?
ne
200 ok
Respons
CuenT
*
SUCCESS PUL RESPONSES, REDIRECTION MESSAGES.
2oo oK
Zol MOVED PERMANENTLY
THE RESOURLE HAS REEN MOVED
PERMANENTLY To THE NEW URL.
EVERYTHING 1S FINE
201 CREATED
NEbI RESOURCE WAS
CREATED
Atul iwmar (unkeDin).
EY RAN” KISTES GHLLER
4oo BAD REquesr 40s UNAUTHORIZED
INVALID SYNTAX. CREDENTIALS ARE INCORRECT.
403 FORBIDDEN
YOU DON'T HAVE PERMISSION TO ACCESS THE Resougces
404 NoT FOUND
JNVALIO URL 4249 Too MANY REQUESTS
USER HAS SENT TOO MANY REQUEST
INA GIVEN AMOUNT OF 1Me.
SERVER ERROR
500 INTERNAL SERVER ERKOR
SERVER DOES NOT KNOW How) TO HANDLE THE UNEXPECTED S/TuRTION,
ATUL KUMAR CLINKEDIN )-HITP REQUEST METHODS
___ Get / apis
200 OK
eS 2 Ee
THE GET method is the most
Common of atl these
vequest methods.
Jt ig used to Fetch the desired
yetources £yom fhe ervey.
Tne Put method is used
whenever you need fo change
tne yvefource. The vesource,
Which if already a Part of
resource collection.
The VosT method
iS used 40 submit
the Information to
the servers
AS We're submitting the deta,
the Post method often changes the
State of the server.
The PATCH vequest method *£
Used to modify only tne
necersary part of phe data or
response.
The PATCH method doesn't mModé fy the
entre yecponse.
Arut mamne( Linkedin)
TECEGRAN ~ NOTES GAL ERY.
AS the name soys, phe DELETE veguest Method is used
te delete the Specified resource.
tt vt
ests that the origin server delete the
resource identified by phe Reguest- URL.
ATUL KUMAR LLINKEDIND:Arceoss Control HITP Headers
—— Request oo | @
Gn]
i_—__} T'S A CROSS -ORIGI REQUEST
Bom) LET ME Abd THE O4IGII
HEADER JO TELL THE SERVER
WHERE THE REqQues®? 1S
COMING FROM.
ACCESS -ContRot- REGEST-METHOD
| penal 10 MAKE LET ME ASK THE SERVER.
A CROLS-ORIUN
POST REQUEST
ACCESS -CONTROL- REWEST [00 |
eels neerr oma (mage |
ibom
TiS 1SA PREFLIGHT REQUEST TO LET
THE SERVER KNOW! WHICH METHOD
WILL BE USED IW THE MAIN REGOEST |
A.Cord ORIGIN IS
ALLOINED TO ACCESS
RELOURCES peOM
B.00M,
, Pris 1£D1€ RESPONSE TO
, ME PREFUGHT REQUEST
Bk, INDICANAG THAT maAiAl
Co REQUEST CAN BE MADE
USING CREDENTIALS.
ACLESS CROSS ~
ORIGIN RESOURCES,
THUS 1S MHE PRERIGHT
REQuesT.
iL Kumar LLINKEDIAL).fz
Client. Sean
ATUL KUMAR LLINKEDIND.
—Caching in AFT Cais
—, Cache
Get/eost™ A
Cache is
emPety
Cache~ Control ! max-age
ee cache
J POLES
re)
Serve
= 100/posts
Atul Korie (LIAIKEDIA J.
phat should
Mey-age 210° 140?
ee7o0
Hente othe server
ts Fresh.
(Aleit for 1000
Seconds unti)
cache get state.
ATL KUMAR CCINICED ICY
“TECEFRAN - NOTES GALCERY.