Use this tag for issues with pre-request scripts in postman, use the "postman" tag for general issues
Questions tagged [postman-pre-request-script]
319 questions
0
votes
1 answer
In postman tests, How to assert the response parameter which as special chars in it
I'm using postman tests section to automate the APIs
If the response parameter is something like this "currency": "USD",, then we assert this by pm.expect(jsonResponse.currency, 'USD');
But if the response parameter is something like this…

Jagadeesh
- 358
- 5
- 17
0
votes
0 answers
POST Request not working ( probably because of some request header missing ) Python Request automation
first , im just starting on http requests , im trying to learn automation using http requests , due to its speed .
well i installed the requests lib , on python and tried some simple sites with GET and POST method , all was fine , since they was…

Mill Pill
- 1
- 1
0
votes
0 answers
postman - read local json file and stringify it before setting to env variable
Currently while using Postman, I am facing an issue where I am not able to read content from local json file. The content from this json is stringified using bash commands.
Context:
I have yaml file and converted that to json using yq -o=json eval…

Tech Girl
- 11
- 3
0
votes
1 answer
Postman Pre-req how to verify post body that has correct body with correct field
For the post request I have this knid of body
{
"callbackUrl": "http://test.io",
"secret": "ygc28gc2VjcmV0"
}
I want to verify does the body has all requied fields such as callbackUrl and secret.
How do I check it in Pre-req script and…

Masi Boo
- 635
- 1
- 10
- 24
0
votes
0 answers
Invalid name parameter using collection runner to copy workspace in Postman
I am copying a workspace using the sample script “Copy a Workspace”.
While GET workspace returns 200, the POST workspace request is returning this error:
“TypeError: Cannot read properties of undefined (reading ‘id’)”
When I look at the response…

malinbrok
- 1
- 2
0
votes
0 answers
Postman Pre-request script for Token
I try to write Pre-script for auto-refresh for token before any request. I know about async, but for first two pm.sendRequest everything is okey, but last pm.sendRequest failed for some reason with error "unauthorised". But Activation token from…

Andrey Mokeev
- 1
- 1
0
votes
1 answer
How to run a request only once with many iterations in Postman
I tried to look everywhere, but no luck so far. I have a collection with 6 requests that run automatically, but I need the last request to run only once at the end of the last iteration.
I tried to use this code in Pre-request Script of Request 5
if…
0
votes
0 answers
Postman - How to sent .json file as POST data payload within pre-request scrpt?
For the purpose of my testing, I need to fetch .json file at pre-request script section and use it as payload for POST request using Postman, then once been fetched need to alter some data on it.
My .json looks like:
{
"email": "test@gmail.com",
…

vlatko606
- 909
- 1
- 13
- 21
0
votes
1 answer
Postman, problems calculating HMAC on a request body using variables
I am trying to create an authenticated request using HMAC. I calculate the HMAC in the pre-request script and everything works ok when using a static request body. However, if I use variables within the request body it breaks because the script is…

T Nguyen
- 3,309
- 2
- 31
- 48
0
votes
1 answer
Using Postman How to write a test to check for duplicate ids
I would like to write a test in Postman that validates there are no duplicate values in the array of objects. Here is an example response:
This is my json response :
{
"content": [
{
"id":…

Shams
- 43
- 9
0
votes
0 answers
How to Read the Payload from Browser-Network tab and use it in postman as Header in another request
In my 1st Request- i am getting Re-direction url in Response.
Once provide the Redirection url in Chrome browser, User will get Payload in Network tab.
Same Payload value need to provide in Another postman request in Param section.
So same request…

prem
- 81
- 1
- 3
- 12
0
votes
1 answer
How do generate request ID for postman testing
In my project,I need to send request ID in request for postman API testing.
It is a google server based application project.For job creation in application,an unique ID will be sent along with required details in request as json format.
That ID will…

IshuVisha
- 13
- 3
0
votes
0 answers
Removing parameters outputted in JSON response. How to remove array and only show specific array of fields in Postman?
Removing parameters outputted in JSON response. How to remove the array and only show a specific array of fields in Postman?

Vivek V
- 93
- 1
- 6
0
votes
0 answers
In Client Assertion, issued time and expiry time are both coming as in past before the client assertion api call from postman
We are facing issue regarding, when we are call "Create JWT Client Assertion' API call from postman we can see 'Issued Time (iat) and Expiry time(exp) both coming as past values even before we are making the client assertion call.
Finally, when we…

Suvradip
- 1
0
votes
1 answer
How to validate the JSON key from global variables using javascript
I am new to javascript, can someone help me how can I validate the JSON key from global variables using javascript in Postman.
I want to read the dd value(1566) by passing the ID value from global variables. Please refer the screenshot attached…

Quick learner
- 699
- 4
- 22
- 39