Open In App

How to set header request in Postman?

Last Updated : 12 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Postman is a powerful API development tool that offers a feature known as environment variables. These variables are used for efficient testing and development of APIs by allowing users to manage dynamic values across requests easily. In this article, we will learn How you can set header requests in Postman.

Prerequisites

Some APIs require you to send particular headers along with requests, typically to provide more metadata about the operation you are performing. These headers are in the form of key-value pair values.

Automatic Headers:

Postman will automatically add certain headers to your requests based on your request selections and settings. Select hidden at the top of the headers tab for information about what Postman will send with your request as shown below

z180

Some other user-defined headers can be passed as a key-value pair. Follow below steps to add headers request

Steps to set header request in Postman?

Step 1: After downloading and installing the Postman, open the software. Add a new Collection and give it a name like “GFG”.

Step 2: When you hover, on the name of your collection, 3 dots will appear. Click on those 3 dots, and then click on “Add new request”

z159

Step 3: You need to select “GET/POST/PUT/DELETE etc” request from the dropdown down menu as per requirement and click on “Headers” Tab as shown below.

Example: In this example, we are selecting “GET”

z181

Step 3: Now You can simply paste the API in the space provided and click on Send. Output will be shown in the body with the status code; 200 (OK)

API Used:

https://api.api-ninjas.com/v1/emoji?name=slightly smiling face

To call this API: we need to provide Headers as mentioned below

Headers:

x-api-key (required) - API Key associated with your account.

You can get API key associated with your account by creating an account on this website

https://api-ninjas.com/api/emoji

Output:

Recording-2023-12-09-at-204359


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads