api request response code example
Example 1: api request
Request
Request URL (ENDPOINT)
http://54.158.178.13:8000/api/spartans
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: api response
Response
Status code
2xx -->> success
4xx -->> client side error
5xx -->> server side error
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