Great video Valentin, I've done loops similar to this in the past but I didn't realise the clever trick you can do with Arrays and Objects. Top Tip :) Makes the code cleaner too 👍🏻
I had 80 calls to make, I tried writing some axios js to do this, then gave up and tried postman ‘flows’, gave up on that and was about to start doing them all manually… then I found this video. You saved me a lot of time. Thanks so much.
Same logic is not working for array of strings. Have tried for Id and names. When tried with IDs it's working fine. Is there any other solution to deal with names. Please reply me
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
Thank you sm!! What even ChatGPT couldn't help me with, you could! So thank you Valentin. P.S could you share the video recording tool(s) you used? again, thank you!
Loved it. How can I turn my looping and processing logic that I have written in Postman with your help to a stand alone API tat is running on a Linux box perhaps. Please point me to a course or a lecture you have published. I would love to take a paid course if one exists. Thanks for all you do
You may want to learn about Newman, which helps you run a Postman collection on any OS. You can't turn a Postman collection into an API. For courses, see the video description.
Super useful lessons! Well done! I also have a question. I have a POST for inserting some fields, and I want to test if the ID , which is unique, can be inserted twice? How can I run the same request twice? Thank you very much!
Hi, I’ve tried to apply this tutorial to some work I’m doing but my response is a nested object (I’m really new to postman and working with APIs in general but I think this is what it’s called). I need to create an array from one of the fields in this nested object but because the response I’m getting isn’t an array the map function isn’t working. Would it be possible to create a new example that would work off of nested object? If you have this already I’m sorry, I’ve tried to find it but have been unsuccessful thus far. Cheers!
Hey! Great stuff! Thanks. I have a question regrding this. How to filter or find specicic value from a nested array? Response looks like this: [ { "attributes": [ { "id": 54, "name": "Farbe", "options": [ "Grau" ] }, { "id": 57, "name": "Größe", "options": [ "60 x 20 x 1.5 cm" ] }, So, I want to save to a variable the value from "options", but only if the name in an object is "Farbe"? How that function would look like?
And I forgot to say, position of those nested objects may varay depending on a product. Some products do not have colors (first object in this case has color: this part "Farbe") for instance, so something like: const ean = response.map(data => data.meta_data[2].options[0]); will not work. Actually, it will work, but it will picup different data based on attribute existance.
@@vdespa Hey! Thanks for getting back. I will research that. If you already have something helpful on this topic in your portfolio, please share it. Or maybe you have just got a new topic for upcoming tutorials... :)
Hi valentine, If I want to pass this id into next call path parameter then do I need to do any change or same script will work . I am getting undefined shift error
Hey Valentin Why we need to connect database with Postman? what will be the actual scenario when we need to the connect database..and if we will connect database can we do anything in database with postman? what about security and integrity issue.
Hi valentine, I have two queries, 1. Why did we use "variables" instead of "environment variables" 2. I have 605 id(s), but when ran the collection it ran for 1210 iteration . why is that?
I have used local variables, as they are no persisted. You can use any type of variables. Start with a smaller data set and use console.log to debug what is going on.
Hello Valentin! I have a question. How can implement a wait function? I am asking because I noticed not all requests are received, at run collection it is the iteration field and there if I put 10 requests I get 4 or 7. How can fix this problem?
Hi valentin. I want to know how i push response into variable. Here example. Va is virtual account 1. Post create virtual account 2. Get the VA number then Push VA number to variable. 3. Repeat process 1 and 2 until all bank VA is created or 5 times. I stuck at this. I need va number foranother request in my api.
It is hard to answer this with the given information. Consider posting your question in the Postman community (community.postman.com/) and share what you have tried so far and where did you get stuck. Include screenshots and as many details as possible. Feel free to tag me with @vdespa. Thanks!
Hi If I save the values in CollectionVariable or environment variable then it always return first vlaue and shift function not working. Its only working with local varible.
Hi.brother, I my collection there are four request First is auth Second is init Third is logic Fourth is end So i want to run third and fourth request multiple times(eg:10) ,how i can do this(third request contains session id which need to passed to fourth and then from fourth request session id need to be passed to third requestm)
I have 1 GET request and 2 PUT requests in the collection.How do I pass the same variable in the second PUT request? variable is passing only in the first PUT request
Hi , I am facing issue in handling workflow. "postman.setNextRequest()" is going infinite loop even though there is stop workflow code postman.setNextRequest(null);. Here is my piece of code. if(Array.isArray(req) && req.length>0) { postman.setNextRequest('Create Patient');//my post API name-Create Patient } else if(requestArray.length==0){ postman.setNextRequest(null); } req is my array which has multiple entries in it. Great if you could help in resolving . Thanks in advance.
Thanks for this video! If I run my collection, it still executes previous request each time as well. How to set to execute only second call in multiple times?
@@vdespa Do you know how to write a script for creating a csv file on desired location and fill it by the variable values that I created in Tests of request?
Hi Sir, I am having a post request in my collection. When I run the entire collection I need that particular request to be repeated 10 times. So now as per your method i can call that request 10 times, once it is done will the next request in the collection will be continued? Or this statement postman.setNextRequest(null) will stop the collection run?
Valentin - I need your help please. Problem - I am Running a Post request to create a Loan 1 by sending L1 in the request. Similarly I need to test Loan types from L1 to L13. These loan types will be created using the same Post request, just by replacing L1 with L2 or L3 or L3 and so on. I am passing the loan types in CSV file as shown in your video. And it works as expected. I see that for 13 types of loan types, I get 13 iterations in my html reporter. Which is again as expected. But how do I merge those 13 iterations into 1 iteration. How do I create a report which will just have 1 iteration, which will display the results for all 13 loan types. Let me know please
Hi Sir, I have two clarifications. 1. If I get a array [1,2,3] in a response how to pass the array in another request as [3,2,1]. 2.. If I get a array [1,2,3] in a response how to pass the array in another request as [ 1, 2, 3 ].
Hi Sir, we are getting an array of values and passing one by one in the next request using shift function... Is there a possibility to pass the value in the reverse order? I mean if I have an array of values [12345] then i have to pass 5 in the first request and 4 in the second run. Can you please help me?
Hey Valentin! First and foremost the video is really helpful and informative. I have landed into an error that I'm not able to fix on my own and thought you might be able to assist. I'm getting the error TypeError: Cannot read property 'shift' of undefined when I execute the Run Collection. In GET tests script section I have below code: const response = pm.response.json(); const tagnamess = response.map(tagname => tagname.name); console.log(tagnamess); pm.variables.set('tagnamess',tagnamess); And in POST pre-request script section I have below code: const namess = pm.variables.get('namess'); pm.variables.set('currentnamess', namess.shift()); And in the POST request body section i have below: { "tag": { "name": {{currentnamess}} } } What is that I'm missing? Please treat that as urgent, thanks!
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
Hi sir.. can we pass an array of values as query param in postman... For each of the value in array i will have the decoded value in the response. Can i get those values as array. For eg i have array ["Arun","Kumar","Raj"].. for each of this value.. i will have a decoded value in response. I have to get those values in another array. Could you please help with this. 🙂
It is hard to answer this with the given information. Consider posting your question in the Postman community (community.postman.com/) and share what you have tried so far and where did you get stuck. Include screenshots and as many details as possible. Feel free to tag me with @vdespa. Thanks!
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
Please help me Valentin I am unable to run tests in Postman even after following the exact same steps, if you would just connect with me for a 5 min session then I would be grateful.
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
Want to have ME be your Postman teacher? 🤔
Here's how: vdespa.com/courses/
Great video Valentin,
I've done loops similar to this in the past but I didn't realise the clever trick you can do with Arrays and Objects. Top Tip :)
Makes the code cleaner too 👍🏻
Thanks, Paul. I am glad you have learned something new.
I had 80 calls to make, I tried writing some axios js to do this, then gave up and tried postman ‘flows’, gave up on that and was about to start doing them all manually… then I found this video. You saved me a lot of time. Thanks so much.
You're welcome, I am glad it helped. What was the issue with Postman flows?
@@vdespa I just couldn’t work it out, I prefer to use JS code
Very clear and helpful!
You are welcome. Thank you for leaving a comment.
Awesome Valentin, got me around a problem I'd been scratching my head about for a while here!
You are welcome. Thank you for leaving a comment.
Perfect. Just what I needed to know.
You are welcome. Thank you for leaving a comment.
What an enlightening lesson ! Thank you kind sir
Glad you enjoyed it! You are welcome. Thank you for leaving a comment.
Great explanation, you saved my day!
Glad to hear it! You are welcome. Thank you for leaving a comment.
I can't thank you enough for this great video
You're very welcome!
Great video and explanation!
Glad you liked it! You are welcome. Thank you for leaving a comment.
This video was very helpful. Thank you
I am glad it helped!
Great stuff! You are creating great content to help with learning API with Postman! Thank you!
Glad you enjoy it! You are welcome. Thank you for leaving a comment.
thank you so much, it really helped me a lot
You are welcome. Thank you for leaving a comment.
Such a Fabulous Video
You are welcome. Thank you for leaving a comment.
Nice tutorial
Thanks 👍
thank you , this video was useful
Glad to hear that! You are welcome. Thank you for leaving a comment.
Thank you it is very hepful
You are welcome. Thank you for leaving a comment.
Brilliant video 👍
Glad you enjoyed it
It's very useful, thank you!
Glad it was helpful!
I this begginer level, or little bit advanced postmen level?
Thanks A lot😍🤩
You're welcome 😊 Thank you for leaving a comment.
So handy, thanks.
I am glad that you liked it!
This is great. Do you have a video of this for XML responses?
Great Video
Glad you enjoyed it. Thank you!
Good video
You are welcome. Thank you for leaving a comment.
you saved my day! thanks a lot~!
Glad to hear that! Happy to help.
Same logic is not working for array of strings. Have tried for Id and names. When tried with IDs it's working fine. Is there any other solution to deal with names. Please reply me
Sir i don't understand , i followed the same steps as you did but it is saying that response.map is not a function and giving error
Same here, was there additional dependencies required?
I am having the exact same problem too. It says response.map is not a function. How do I fix that?
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
@@vdespa The discord link expired, may I have a new one?
Hi.. I have tried this but keeps running with the 0th index value and doesn't exit.
Thank you sm!! What even ChatGPT couldn't help me with, you could! So thank you Valentin.
P.S could you share the video recording tool(s) you used? again, thank you!
Glad to hear that. OBS.
awesome help! well explained. that intro is way too corny! lol
Glad you liked it! Thank you!
Loved it. How can I turn my looping and processing logic that I have written in Postman with your help to a stand alone API tat is running on a Linux box perhaps. Please point me to a course or a lecture you have published. I would love to take a paid course if one exists. Thanks for all you do
You may want to learn about Newman, which helps you run a Postman collection on any OS. You can't turn a Postman collection into an API. For courses, see the video description.
Great video! How to run collections async?
Hi sir.. can we pass an entire response of a get call as a body to the next post api call?
Super useful lessons! Well done! I also have a question. I have a POST for inserting some fields, and I want to test if the ID , which is unique, can be inserted twice? How can I run the same request twice? Thank you very much!
You are welcome. Thank you for leaving a comment.!
Hi,
I’ve tried to apply this tutorial to some work I’m doing but my response is a nested object (I’m really new to postman and working with APIs in general but I think this is what it’s called). I need to create an array from one of the fields in this nested object but because the response I’m getting isn’t an array the map function isn’t working.
Would it be possible to create a new example that would work off of nested object?
If you have this already I’m sorry, I’ve tried to find it but have been unsuccessful thus far.
Cheers!
I want to make an add-on program that monitors the console (listens), separates some commands and sends them back to the server.
Hey! Great stuff! Thanks. I have a question regrding this. How to filter or find specicic value from a nested array? Response looks like this:
[
{
"attributes": [
{
"id": 54,
"name": "Farbe",
"options": [
"Grau"
]
},
{
"id": 57,
"name": "Größe",
"options": [
"60 x 20 x 1.5 cm"
]
},
So, I want to save to a variable the value from "options", but only if the name in an object is "Farbe"? How that function would look like?
And I forgot to say, position of those nested objects may varay depending on a product. Some products do not have colors (first object in this case has color: this part "Farbe") for instance, so something like:
const ean = response.map(data => data.meta_data[2].options[0]);
will not work. Actually, it will work, but it will picup different data based on attribute existance.
You may want to get familiar with the filter function on arrays.
@@vdespa Hey! Thanks for getting back. I will research that. If you already have something helpful on this topic in your portfolio, please share it. Or maybe you have just got a new topic for upcoming tutorials... :)
Hi valentine, If I want to pass this id into next call path parameter then do I need to do any change or same script will work . I am getting undefined shift error
i have list of items but shift() method always it's taking first value in the list please guide me
Which value is it taking?
Hey Valentin Why we need to connect database with Postman? what will be the actual scenario when we need to the connect database..and if we will connect database can we do anything in database with postman? what about security and integrity issue.
I did other tutorials on connecting to a database. See my channel.
Hi valentine, I have two queries,
1. Why did we use "variables" instead of "environment variables"
2. I have 605 id(s), but when ran the collection it ran for 1210 iteration . why is that?
I have used local variables, as they are no persisted. You can use any type of variables.
Start with a smaller data set and use console.log to debug what is going on.
Hello Valentin!
I have a question.
How can implement a wait function? I am asking because I noticed not all requests are received, at run collection it is the iteration field and there if I put 10 requests I get 4 or 7.
How can fix this problem?
Hello Sebastian: I am not sure I get the problem. At which point do you need to wait?
Hi valentin. I want to know how i push response into variable.
Here example. Va is virtual account
1. Post create virtual account
2. Get the VA number then Push VA number to variable.
3. Repeat process 1 and 2 until all bank VA is created or 5 times.
I stuck at this. I need va number foranother request in my api.
You may need to learn a few Postman basics before getting into scripting. See the video description for courses and other tutorials.
How would you extract ids being the response object, not an array?
It is hard to answer this with the given information. Consider posting your question in the Postman community (community.postman.com/) and share what you have tried so far and where did you get stuck. Include screenshots and as many details as possible. Feel free to tag me with @vdespa. Thanks!
Hi
If I save the values in CollectionVariable or environment variable then it always return first vlaue and shift function not working.
Its only working with local varible.
I doubt this is the case. Double check your code, use console.log to debug.
Hi.brother,
I my collection there are four request
First is auth
Second is init
Third is logic
Fourth is end
So i want to run third and fourth request multiple times(eg:10) ,how i can do this(third request contains session id which need to passed to fourth and then from fourth request session id need to be passed to third requestm)
Look into setNextRequest
I have 1 GET request and 2 PUT requests in the collection.How do I pass the same variable in the second PUT request?
variable is passing only in the first PUT request
Once you get a variable, it is available in all upcoming requests.
Hi , I am facing issue in handling workflow. "postman.setNextRequest()" is going infinite loop even though there is stop workflow code postman.setNextRequest(null);. Here is my piece of code.
if(Array.isArray(req) && req.length>0)
{
postman.setNextRequest('Create Patient');//my post API name-Create Patient
}
else if(requestArray.length==0){
postman.setNextRequest(null);
}
req is my array which has multiple entries in it.
Great if you could help in resolving .
Thanks in advance.
ADD some console.log statements to your code to better understand what is going on.
Nice, but it doesn't work :(
Thanks for this video! If I run my collection, it still executes previous request each time as well. How to set to execute only second call in multiple times?
Hard to say. Double check your setNextRequst value.
@@vdespa Do you know how to write a script for creating a csv file on desired location and fill it by the variable values that I created in Tests of request?
@@nikolaurevac7175 You can't do that in Postman. Search my channel for a CSV tutorial.
Hi Sir,
I am having a post request in my collection. When I run the entire collection I need that particular request to be repeated 10 times. So now as per your method i can call that request 10 times, once it is done will the next request in the collection will be continued? Or this statement postman.setNextRequest(null) will stop the collection run?
Yes, once you have iterated the desired number of times, the next request will be called (unless otherwise indicated).
TypeError: Cannot read properties of undefined (reading 'shift')
Check your code, use console.log to make sure the property you are using exists.
Valentin - I need your help please.
Problem - I am Running a Post request to create a Loan 1 by sending L1 in the request.
Similarly I need to test Loan types from L1 to L13. These loan types will be created using the same Post request, just by replacing L1 with L2 or L3 or L3 and so on.
I am passing the loan types in CSV file as shown in your video. And it works as expected. I see that for 13 types of loan types, I get 13 iterations in my html reporter. Which is again as expected.
But how do I merge those 13 iterations into 1 iteration. How do I create a report which will just have 1 iteration, which will display the results for all 13 loan types.
Let me know please
If the data is coming from a CSV file, you can't read the entire data set at once. This is why you have 13 iterations.
@@vdespa can I merge 13 iterations into 1 if I use a Json file as a input
Hi Sir, I have two clarifications.
1. If I get a array [1,2,3] in a response how to pass the array in another request as [3,2,1].
2.. If I get a array [1,2,3] in a response how to pass the array in another request as [
1,
2,
3
].
You can use JavaScript to transform the array to your needs.
Hello . But why postman show me the Response.map not a function?
Probably because it is not an array
@@vdespa how can I check array is true ?
Hi Sir, we are getting an array of values and passing one by one in the next request using shift function... Is there a possibility to pass the value in the reverse order?
I mean if I have an array of values [12345] then i have to pass 5 in the first request and 4 in the second run. Can you please help me?
Instead of shift(), you can use pop()
@@vdespa Thank you very much 👍
Hey Valentin!
First and foremost the video is really helpful and informative. I have landed into an error that I'm not able to fix on my own and thought you might be able to assist.
I'm getting the error TypeError: Cannot read property 'shift' of undefined when I execute the Run Collection.
In GET tests script section I have below code:
const response = pm.response.json();
const tagnamess = response.map(tagname => tagname.name);
console.log(tagnamess);
pm.variables.set('tagnamess',tagnamess);
And in POST pre-request script section I have below code:
const namess = pm.variables.get('namess');
pm.variables.set('currentnamess', namess.shift());
And in the POST request body section i have below:
{
"tag": {
"name": {{currentnamess}}
}
}
What is that I'm missing? Please treat that as urgent, thanks!
@valentin despa, can you please check this?
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
Hi sir.. can we pass an array of values as query param in postman... For each of the value in array i will have the decoded value in the response. Can i get those values as array. For eg i have array ["Arun","Kumar","Raj"].. for each of this value.. i will have a decoded value in response. I have to get those values in another array. Could you please help with this. 🙂
It is hard to answer this with the given information. Consider posting your question in the Postman community (community.postman.com/) and share what you have tried so far and where did you get stuck. Include screenshots and as many details as possible. Feel free to tag me with @vdespa. Thanks!
How to updates multiple records multiple updates postman to postgresql sqlalchemy ?
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
Please help me Valentin I am unable to run tests in Postman even after following the exact same steps, if you would just connect with me for a 5 min session then I would be grateful.
It is hard to answer this with the given information. Join the Discord community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
46th...Thanks
46th what?
@@vdespa It means Im the 46th who smashed the like button
@@jopadjr thanks 👍 keep it coming for other videos. You are the best
@@vdespa sure...I'm learning a lot from you mate.. Keep up the good work.. Cheers !!!
Looking forward for a remake using postman flows🫡