Questions tagged [postman-pre-request-script]

Use this tag for issues with pre-request scripts in postman, use the "postman" tag for general issues

Reference:

319 questions
0
votes
2 answers

Get response url from Postman Pre-Request Script

I need to get the url of the response (after any redirects) from a request made in the Pre-request Script. Is this possible in postman? The postman response object doesn't seem to include the url…
Liam Bell
  • 55
  • 1
  • 8
0
votes
1 answer

Postman pre request script, How write pre request script to get value from csv file to store in variable and use on xml body?

I am trying to write pre request script to get value from csv file to store in variable and use on xml body, but I don't know where to start. Postman Xml body that I will get a value csv file to assign a value on FirstName_Variable ,…
0
votes
2 answers

Loop Query Parameter Postman

im trying to test API using loop query parameter tools but the issue is that the query paramas is getting only the last value of "mark", what i need is to run and test every mark and render it into url, here my Pre-request Script and here is the…
0
votes
1 answer

Postman access refresh_token?

I configured Postman to use the authorization code flow. Problem is our tokens expiry pretty fast and I need to re-run the flow every time it expires. So I was thinking to implement a refresh_token flow in the pre-requests script (unless there is a…
Moritz Schmitz v. Hülst
  • 3,229
  • 4
  • 36
  • 63
0
votes
1 answer

InvalidToken: De-serialization error -- POSTMAN

I use fabric Kony and I have given to Postman Username pass of Fabric to authenticate enter image description here and entered this prerequest script: const postRequest = { url: 'https://sandbox-api.marqeta.com/v3/swagger.json', method: 'POST', …
zante
  • 1
  • 1
0
votes
1 answer

Getting END OF FILE Expected on Postman

I'm using the following JSON body on a postman request and I'm getting a END OF FILE Expected error: "customer": { "gender": 1, "company": "MyCompany", "name": "Doe", "firstname": "John", "phone": "0606060606" , "address": { "address": "123 main…
0
votes
1 answer

Why does this Postman script HTTP POST generating an error?

I have a API call that takes a POST body of raw: {"category":1, "fmipstatus":true} and it is of type JSON. Content-Type is application/json I use Postman to send this API call and I get a 200 response code. I want to code this call as part of a…
reza
  • 5,972
  • 15
  • 84
  • 126
0
votes
2 answers

How to run the "set a Global Variable" only once in POSTMAN and use them for all the keys In the collection

I have a request body as follows, Here I need the keys "id", "sys2Acct" and "shortName" to be set to a same value. NOTE: the request body has huge number of key's, I somehow want to assign the same number (i.e random) to the mentioned keys in this…
0
votes
0 answers

SyntaxError Unexpected token at test-script

I have a Collection that has POST requests in it. This collections needs bearer token for auth. The Pre-request script and Tests assertion is written at Collection level. Problem: The collection works fine when ran in Postman, but when I run it in…
seth
  • 1
  • 1
0
votes
1 answer

Authorization_code from authentication response in the Postman prerequest script

For many collections in Postman we use authorization with the grant type=Authorization code (to Azure). For requests using the grant type client credentials I'm able to write the prerequest script which acquires the token automatically (if needed)…
Filip M.
  • 89
  • 9
0
votes
0 answers

List Pull request using the Github API in the pre-request-script from Postman

I have to retrieve the Github pull request, using the url: https://api.github.com/repos///pulls/ and the repo https://api.github.com/repos// I tried to use Octokit.js -> https://github.com/octokit/core.js#readme…
rasilvap
  • 1,771
  • 3
  • 31
  • 70
0
votes
1 answer

First char in an enviroment var is being stripped when using moment in Postman

Using moment in Prerequest: var yesterday = moment().subtract(1, 'days').format("yyyy-MM-DD"); console.log(yesterday); var pastDate = yesterday; pm.environment.set("pastDate", yesterday) Request Body: "AccountId": 1, "StartDate":…
Jimmy
  • 85
  • 1
  • 11
0
votes
1 answer

Postman automation

Postman - I have a request which is in 2 part. In 1st part(POST request), it will generate a pre signed s3 url and in 2nd part(PUT request), a document need to be uploaded in the generated pre-signed url. I need to automate this flow. Can anybody…
0
votes
0 answers

My request won't repeat itself after executing

So I have a request in Postman that will create a User for me. I want to run it automatically for a certain amount of time to save time preparing datas. I try using setNextRequest but it doesn't work. I have tried to put it in Pre-request Script,…
0
votes
1 answer

Pre-request Postman script for Swagger petstore

Learning Postman, and got some trouble making DELETE call with POST call in pre-request script. Aim is to make only DELETE call without having to make POST call each time. Endpoint is swagger petstore. So, DELETE is for deleting pet by ID and POST…
andrtvrd
  • 1
  • 3