How to find Header Key Value information for Host

How do I find out what the VALUE is for KEY: Host within a GET function?

Details (like screenshots):


I need to connect to a third party system to get data for reporting. I used Postman to test the connection to the third party. I successfully set up a GET function that outputs the data I need.

Now I need the URL to use in my system to connect to the third party system. What I have tried so far does not work. The only piece that I can think I am missing is the Header Key Host’s value. It is set to . I was wondering how do I find what that value is?

I have tried the URL Copy function from another post and that does not work, it just gives me the same URL that I have entered in the GET area.

@aeshirl Welcome to the community :partying_face:

You can access the URL and the path parameters using lodash get() method

console.log(_.get(pm.request, 'url.host'));

Else you can access the headers like below:

let requestHeaders = pm.request.headers.all();
console.log(requestHeaders);
console.log(requestHeaders[4].value);

I tried with “https://postman-echo.com/post

4 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.