Rest API & API
Rest API & API
With the availability of the endpoints, the backend service does not have to worry
about the client implementation. It just calls out to its multiple clients & says
“Hey everyone, here is the url address of the resource/information you need. Hit it
when you need it. Any client with the required authorization to access a resource can
access it”.
What Is A REST API
Decoupling Clients & the Backend Service:
Developers can have different implementations with separate codebases, for different
clients, be it a mobile browser, a desktop browser, a tablet or an API testing tool.
Introducing new types of clients or modifying the client code has no effect on the
functionality of the backend service.
This means the clients and the backend service are decoupled.
API Gateway
The REST-API acts as a gateway, as a
single entry point into the system. It
encapsulates the business logic.
Handles all the client requests, taking care
of the authorization, authentication,
sanitizing the input data & other necessary
tasks before providing access to the
application resources
REST Request Response
GET https://restexample.com/users?name=John
{
"name": "John",
"age": 5,
"address": "Greenville"
}
SOAP Request Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope /"
xmlns:sch="http://www.soapexample.com/xml/user s">
<soapenv:Header/>
<soapenv:Body>
<sch:UserDetailsRequest>
<sch:name>John</sch:name>
</sch:UserDetailsRequest>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope /">
</soapenv:Body>
<soapenv:Header/>
</soapenv:Envelope> <soapenv:Body>
<ns2:UserDetailsResponse xmlns:ns2="http://www.soapexample.com/xml/user s">
<ns2:User>
<ns2:name>John</ns2:name>
<ns2:age>5</ns2:age>
<ns2:address>Greenville</ns2:address>
</ns2:User
</ns2:UserDetailsResponse>
</soapenv:Body>
</soapenv:Envelope>
HTTP Method
HTTP HEADER FIELDS
HTTP STATUS CODES
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
HTTP 2