request from api 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 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.

Tags:

Misc Example