Example 1: api request
Request
Request URL (ENDPOINT)
http:
HTTP Methods|Verb : GET POST PUT DELETE PATCH
HEADER : key value pair
Accept , Content-Type
Query Parameters : key value pair right after ?
/api/spartans/search?gender=Male&nameContains=li
mostly used to filter out the result according to
the cirteria provided here
Path Parameters|Variable
/api/spartans/{id} /api/spartans/:id
used to identify single resource among list of resources
Request Body | Payload
the data you are sending to the server
Example 2: request api
REQUEST :(request url,http methods,header,query param, param,body,cookie)
1-)Request Url where we have Endpoint (domain:Port/Endpoints)
2-)HTTP METHODS(Get, Post, Put, Patch, Delete, Header)
Get: For to retrieve resources from the server
Post: to send or add resource to the server
Put: For update the resources in the server
Patch: For partial update the resource
Delete: For deleting the resource in the server
Head: To get header from the response not the body
3-)HEADER is metadata is about the request,
basically providing more information along
with the request.
-Content Type header : to specify what kind of
data we are sending to the server
-Accept Header : to specify what kind of data
format you want to get in the response like (json or xml)
-Authorization header : used to provide the
Bearer token in many api's.
4-)Query Parameter: A key value pair usually
for filtering result
5-)Parameter: for identifying single resource
among the list of resources.
6-)Payload(BODY): for POST,PUT,PATCH request
(json,xml,plainText,URL encoded for data)
7-)Cookie
Example 3: what are response in api
REQUEST :(request url,http methods,header,query param, param,body,cookie)
1-)Request Url where we have Endpoint (domain:Port/Endpoints)
2-)HTTP METHODS(Get, Post, Put, Patch, Delete, Header)
Get: For to retrieve resources from the server
Post: to send or add resource to the server
Put: For update the resources in the server
Patch: For partial update the resource
Delete: For deleting the resource in the server
Head: To get header from the response not the body
3-)HEADER is metadata is about the request,
basically providing more information along
with the request.
-Content Type header : to specify what kind of
data we are sending to the server
-Accept Header : to specify what kind of data
format you want to get in the response like (json or xml)
-Authorization header : used to provide the
Bearer token in many api's.
4-)Query Parameter: A key value pair usually
for filtering result
5-)Parameter: for identifying single resource
among the list of resources.
6-)Payload(BODY): for POST,PUT,PATCH request
(json,xml,plainText,URL encoded for data)
7-)Cookie
RESPONSE :(STATUS CODE,PAYLOAD(body),HEADER,COOKIE,
TIME(spent to get response))
1-Status Code:
2xx - Success
4xx - Client Error
5xx - Server Error
2-Payload(Body) :
The actual resource we got from the server.
Content type can be : plain text, json, xml, html, json etc.
3- Metadata about response to provide more information
4- Cookie
5- Time for getting spended time for the response
Example 4: api request and response
HTTP request method is made up of five components:
Request Method ==> Get, Post, Put, Delete (these are
the common ones)
Request URL ==> the URL of the resource
Request Header ==> Accept-Language, AcceptEncoding, User-Agent, Host
Request Body ==> This is the data to be sent to the
resource
Request Query Parameters : key value pair
HTTP response method is made up of three components:
Response Status Code ==> 200, 301, 404, 500
(these are the most common ones)
Response Header Fields ==> Date, Server, LastModified, Content-Type
Response Body ==> This is the data that comes
back to the client from the server.
Example 5: what do we have in the request and response in api
REQUEST :(request url,http methods,header,query param, param,body,cookie)
1-)Request Url where we have Endpoint (domain:Port/Endpoints)
2-)HTTP METHODS(Get, Post, Put, Patch, Delete, Header)
Get: For to retrieve resources from the server
Post: to send or add resource to the server
Put: For update the resources in the server
Patch: For partial update the resource
Delete: For deleting the resource in the server
Head: To get header from the response not the body
3-)HEADER is metadata is about the request,
basically providing more information along
with the request.
-Content Type header : to specify what kind of
data we are sending to the server
-Accept Header : to specify what kind of data
format you want to get in the response like (json or xml)
-Authorization header : used to provide the
Bearer token in many api's.
4-)Query Parameter: A key value pair usually
for filtering result
5-)Parameter: for identifying single resource
among the list of resources.
6-)Payload(BODY): for POST,PUT,PATCH request
(json,xml,plainText,URL encoded for data)
7-)Cookie
RESPONSE :(STATUS CODE,PAYLOAD(body),HEADER,COOKIE,
TIME(spent to get response))
1-Status Code:
2xx - Success
4xx - Client Error
5xx - Server Error
2-Payload(Body) :
The actual resource we got from the server.
Content type can be : plain text, json, xml, html, json etc.
3- Metadata about response to provide more information
4- Cookie
5- Time for getting spended time for the response
Example 6: api response
Response
Status code
2xx
4xx
5xx
Header
meta data about your response
like Content-Type, Date and some other info
Body | Payload
The response we got from the server
and this where we do lots of validation