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
2 answers
Postman test script - how to call an api twice to simulate 409 error
I am trying to run a few automated testing using the Postman tool. For regular scenarios, I understand how to write pre-test and test scripts. What I do not know (and trying to understand) is, how to write scripts for checking 409 error (let us…

Mopparthy Ravindranath
- 3,014
- 6
- 41
- 78
0
votes
3 answers
Comparing the entire response body by storing in one file and compare that file with current response in postman
I am doing automation script for Functional testing my query is
Send the request and store the entire response body in one file.
Again they send the request and get the new response.
Compare the new response body with a stored response…
0
votes
2 answers
Pre-request script doesn't change the collection variable using Postman
Pre-Request Script:
let user_id = pm.collectionVariables.get("user_id");
pm.sendRequest(`http://security.postman-breakable.com/account/${user_id}/summary`, function (err, response) {
if(response.status == "FORBIDDEN"){
…

semih
- 45
- 1
- 8
0
votes
0 answers
How to get the index of the current request running within the folder in Postman?
How to get the index of the current request within the folder? Depends on the process I'm performing, there can be more Steps, and sometimes there's no "New" request. I'm planning to create an array within the Pre-Request of the folder and will…

eSPiYa
- 882
- 1
- 12
- 29
0
votes
1 answer
How to run the dependent request multiple times till the desired response is not achieved from request in test in Postman
I have Request A and Request B which I have to test in the Postman Test
Condition for testing these API is that Success of Request A is depended on the response of the Request B
When the request A is hit the response from the Request B send the…

jitendra gupta
- 47
- 2
- 11
0
votes
0 answers
How to upgrade to support the post request method? ovh api postman
OVHcloud api
postman Pre-request Script
pm.sendRequest({
url: "https://api.ovh.com/1.0/auth/time",
method: "GET",
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
body: {}
},
function (err, res) {
…

gg 1255
- 1
0
votes
0 answers
Postman, Pre-request Script, copy operation
I have a JavaScript string in my Pre-request Script in Postman. I want to copy it to clipboard. When playing around with the Chrome dev tools I cam simply type copy("my string").
Can I do the same with the Pre-request Script or is my only option…

manymanymore
- 2,251
- 3
- 26
- 48
0
votes
1 answer
Dynamic pre-request script Postman
I have this pre-request script and using runner to send bulk requests each second
const moment = require('moment');
postman.setEnvironmentVariable("requestid", moment().format("0223YYYYMMDDHHmmss000000"));
I need the “requestid” to be…

ashkanyo
- 81
- 6
0
votes
0 answers
Postman : Prevent default behaviour on send request
Description
So, I have a Pre-request script in Postman which runs and gets a API_token, which in turn sets the env variable "api_token". I have set this "api_token" using the script specified in the next section.
Requirement
I want the behaviour to…

Lucifer
- 79
- 6
0
votes
0 answers
I need to assert the response I sent via pm.sendRequest()
I have created a POST request to generate a token for myself. Next, I wrote the code for assertion using pm.test() and its working. Following that, I sent another request via pm.sendRequest(). As a result of this request, I am receiving a response…

Sonu Prajapati
- 1
- 1
0
votes
0 answers
when i change create request's path from "user" to "post" postman is returning html body and inside of it is text Cannot POST /api/posts
basically when i change "http://localhost:5000/api/users" to "http://localhost:5000/api/posts" in Create Request its giving me error if i leave it as it is which is "http://localhost:5000/api/users" if functions properly but for some damn reason…

Gio
- 11
- 1
0
votes
0 answers
Postman pre-request script oder - does not run the requests in the order I expect
Total postman noob. I have a script (well I don't I am trying to) to do the drudge tasks of authentication and authorization which takes 2 requests:
console.log("START");
var authenticationToken;
// Identity token
var authenticationTokenRequest = {
…

user2919960
- 71
- 11
0
votes
0 answers
Postman Automated Collection Generation
has anyone done an enterprise integration of their public API with Postman? Checking Postman pages it seems like everything is straightforward, however, I have some concerns:
I don't see the way to automatically install pre-request scripts.…

Omar Khazamov
- 147
- 1
- 8
0
votes
1 answer
PostMan Pre-Request Script: How Do I Get All Iteration Data In A Single Iteration As An Object?
I am familiar with the syntax to retrieve a single value from a data file in single iteration (shown below), but is there a quick way to retrieve all iteration data within a single iteration as an object? Or do I need to do this the long way by…

Tyler Proctor
- 11
- 1
0
votes
0 answers
Error of authorized to access this resource on postman
I'm using postman for an api request. My question is; I'm getting an error when I made one of the variables random.
For example when I sent request this link;
https://testrest.xxxxxx.com/voucher/purchase/testAUD000/49/1/30000017/1 it is working. But…

caglar.boran
- 1
- 2