As implied by the name, a request is a standardized message sent to an Endpoint requesting to obtain some resources. An example could be a request to obtain all the movies’ names from IMDB database.

🍏🍎🍊 There are multiple types of requests. Some of them are:

  • POST
  • GET
  • DELETE
  • UPDATE
  • OPTIONS
  • PUT

The names suggest what we can achieve when sending these requests.πŸ™‚

The most common ones are GET and POST.

GETPOST
request is visible β†’ less securerequest is invisible β†’ more secure
the data that can be sent is limitedlarger amounts of data can be sent
same request β†’ same response (is not supposed to change the state of the application)same request β†’ potentially different response (can change the state of the application)
is used to get datais used to send data and receive the result of the performed operation
faster and more efficient, less secureslowlier, more secure, can send more data of different types

πŸ›  How to

🐍 Python

import requests

# GET request
r = requests.get("www.example.com/")
r = requests.get("www.example.com/message=mymessage")  # when sending a message as # a key-value pair with "message" as a key and "mymessage" as a value

# POST request
r = requests.post("www.example.com", data={"message": "my message"})

βš™οΈ Resources: