Postman $GUID: Remove hyphens and make all character uppercase
Asked Answered
C

2

5

Can someone help me to remove the hyphens and transform all characters to uppercase (from a postman $guid)?

Haven't find anything useful.

Thanks

Camlet answered 11/10, 2019 at 16:21 Comment(0)
I
15

There are many hacky ways to do this in Postman, here's one of them:

let guid = pm.variables.replaceIn('{{$guid}}')

let formattedGuid = guid.replace(/-/g, '').toUpperCase()

pm.globals.set("newGuid", formattedGuid)

If you add that to the Pre-request Script, you'll be able to use it in the requests.

Instillation answered 11/10, 2019 at 17:8 Comment(2)
What language is this? Would you mind updating the question's tagging appropriately (assuming postman is language-specific)?Fredkin
Postman is a tool written in JS, the Pre-request Script and Tests sandbox environment allow you to use JS do well....whatever you want. It also has it's own pm.* API with certain Postman specific functions.Instillation
E
0

Or you can use the new postman guid generator {{newGuid}}

Embryologist answered 15/9, 2023 at 8:38 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Radiotelephony
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewGolliner

© 2022 - 2024 — McMap. All rights reserved.