returns partial ID

I’m trying to set the request ID as a variable. But when I use the;

I only appear to get part of the ID back in the output. Am I missing something here?

Hey @w4dd325 :wave:

Seems like the first 8 digits are taken from the Collection ID,
So, to match the Request ID and the returned value from ‘’
you need to add part of Collection’s Id to the result.
Here’s one way to do it.

let Request_id=
let Collection_id= //Enter the initial digits from Collection ID

//Final Request ID

Hope this helps.

Hi @bbahadur thank you for your reply… Interesting theory but I tried pulling the collection id using;


But the values still don’t appear to line up.
I could definitely hardcode the values like you suggested above, but I’d be interested to understand where the values are originally produced/stored.

I don’t think you are pulling the right value,
pm.collectionVariables refers to the variables inside the collection, but what is required is the Collection ID.

Take Postman API Collection for Example, down below is the Collection Variables of Postman API Collection.

To get the Collection ID, we check the ‘info’ tab on the right. (i within a circle)

I’m not aware how to retrieve The Collection ID by script, but for the moment you can try copying the ID from here.

Good luck :slight_smile: