Master AI & Build your First Coding Portfolio with SkillReactor | Sign Up Now

Main

4. HTTP Requests

HTTP Requests with POSTMAN

In this chapter, we'll explore how to effectively use GET, POST, PUT, and DELETE requests in POSTMAN to interact with APIs.

GET Request

GET requests are used to retrieve data from a specified resource, similar to accessing a website in a browser.

Basic GET Request

Advanced GET Request

GET requests can include query parameters for filtering data.

URL: https://jsonplaceholder.typicode.com/users?id=2

To pass query parameters, you can either append them directly to the URL or use the Params tab in POSTMAN to enter key-value pairs. POSTMAN will automatically append these parameters to the URL when you send the request.

POST Request

POST requests are used to send data to a server to create or update a resource/record.

To send a POST request:

  • Select the POST method and enter the URL that handles the POST request.

  • Under the Body tab, choose Raw and JSON format to send data.

  • URL: https://jsonplaceholder.typicode.com/posts

  • Body Type: Select Body > Raw > JSON

Example JSON Body:

{
    "title": "Foo",
    "body": "Content",
    "userId": 1
}

This will create a new post in the backend.

PUT Request

PUT requests update existing resources on the server.

To send a PUT request:

Example JSON Body:

{
    "title": "Good to go"
}

DELETE Request

DELETE requests delete resources from the server.

To send a DELETE request: