Skip to main content
"postman.getEnvironmentVariable()" is deprecated (https://learning.postman.com/docs/writing-scripts/script-references/test-examples/#getting-an-environment-variable-deprecated)
Source Link

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); 

or

var encoded = encodeURIComponent(postmanpm.getEnvironmentVariableenvironment.get("phone number")); 

and to proceed, use:

postmanpm.setEnvironmentVariableenvironment.set("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); 

or

var encoded = encodeURIComponent(postman.getEnvironmentVariable("phone number")); 

and to proceed, use:

postman.setEnvironmentVariable("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); 

or

var encoded = encodeURIComponent(pm.environment.get("phone number")); 

and to proceed, use:

pm.environment.set("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

fix the script as per the upvoted comment
Source Link
Adam Millerchip
  • 23.3k
  • 6
  • 62
  • 86
 

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); 
var encoded = encodeURIComponent({{phone number}}); 

or

var encoded = postman.getEnvironmentVariable("phone number"); 
var encoded = encodeURIComponent(postman.getEnvironmentVariable("phone number")); 

and to proceed, use:

postman.setEnvironmentVariable("encoded phone number", encoded); 
postman.setEnvironmentVariable("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); 

or

var encoded = postman.getEnvironmentVariable("phone number"); 

and to proceed, use:

postman.setEnvironmentVariable("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

 

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); 

or

var encoded = encodeURIComponent(postman.getEnvironmentVariable("phone number")); 

and to proceed, use:

postman.setEnvironmentVariable("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

added 101 characters in body
Source Link
Shahar Hadas
  • 2.9k
  • 2
  • 31
  • 30

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); 

or

var encoded = postman.getEnvironmentVariable("phone number"); 

and to proceed, use:

postman.setEnvironmentVariable("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); postman.setEnvironmentVariable("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

Use the Pre-request scripts (it's next to body) for this:

var encoded = encodeURIComponent({{phone number}}); 

or

var encoded = postman.getEnvironmentVariable("phone number"); 

and to proceed, use:

postman.setEnvironmentVariable("encoded phone number", encoded); 

And set your URL to /path/get?phone={{encoded phone number}}

deleted 337 characters in body
Source Link
Shahar Hadas
  • 2.9k
  • 2
  • 31
  • 30
Loading
Add clarifications
Source Link
Shahar Hadas
  • 2.9k
  • 2
  • 31
  • 30
Loading
Pre-request scripts
Source Link
Shahar Hadas
  • 2.9k
  • 2
  • 31
  • 30
Loading
added 2 characters in body
Source Link
Shahar Hadas
  • 2.9k
  • 2
  • 31
  • 30
Loading
added 131 characters in body
Source Link
Shahar Hadas
  • 2.9k
  • 2
  • 31
  • 30
Loading
Source Link
Shahar Hadas
  • 2.9k
  • 2
  • 31
  • 30
Loading