Тёмный

Set the JSON body from an external JSON file in Postman 

Valentin Despa
Подписаться 59 тыс.
Просмотров 36 тыс.
50% 1

In this short tutorial, I will show you how to get your entire JSON request body from an external file.
This can be particularly useful if you want to use different data-sets but keep the same request.
___
// POSTMAN COMPLETE GUIDE ONLINE COURSE
👉 Want to learn more about Postman? Check my Postman online course.
Get it at a special price and help support this RU-vid channel:
www.udemy.com/course/postman-...
___
// I HAVE A QUESTION!
I do my best to answer all comments here on RU-vid but I cannot make any guarantees.
If you have a question, it is best to ask your question on the Postman User Group on Facebook or on the Postman Community (links below).
If you have purchased the Postman Online Course, please use the Q&A section or send me a message on Udemy.
Please do not email me or contact me on other channels as I might not be able to answer. Sorry!
___
// I HAVE A VIDEO IDEA
Do you want me to create a video on a specific topic? Just fill out the form below:
forms.gle/uWEzXFQ2viJtZtvZ7
___
// P L A Y L I S T S
▸ Learn Postman | bit.ly/2CFaf70
▸ Postman Crash Course | bit.ly/2YwEBBT
▸ Postman Tips & Tricks | bit.ly/2JLkXyU
___
// F R E E R E S O U R C E S
▸▸▸ DOWNLOAD the FREE Postman Quick Reference Guide
bit.ly/postman-quick-reference-yt
▸▸▸ JOIN the Postman User Group on Discord
/ discord
▸▸▸ The OFFICIAL Postman community forum
community.getpostman.com/
▸▸▸ 👉 Subscribe to the "Testing and automation with Valentine" newsletter for bi-weekly tutorials, tips, and news from the industry.
eepurl.com/gPwpU1
___
// IMPRINT
vdespa.com/imprint
---

Опубликовано:

 

14 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 93   
@vdespa
@vdespa 4 года назад
👉 Want to learn more about Postman? Check my Postman online course. www.udemy.com/course/postman-the-complete-guide/?referralCode=4E8B90BA4B5EE8DA9237
@pedromonteiro1703
@pedromonteiro1703 Месяц назад
Best video on the subject, straightforward and educational
@vdespa
@vdespa Месяц назад
Thank you!
@jaydeeplakhwani606
@jaydeeplakhwani606 2 года назад
this is what I was looking for two days, new to all these and this video put me so ahead with my work. best one I have seen yet. got exactly what I was looking for
@vdespa
@vdespa 2 года назад
Great to hear that. I am glad that it was helpful.
@davidguerreroarciniegas3518
Thank you inmensely, with this tutorial I just finished an inmense ammount of data in seconds! without breaking my head doing things I did not know, really thank you
@vdespa
@vdespa Год назад
You are welcome. Thank you for leaving a comment.
@christina8893
@christina8893 Год назад
Finally, thank you Jesus! I've been researching on this for the last 24 hours! The other methods out there was complicated for me and didn't give me what I wanted. The toObject was key for me in this tutorial. I will be using this step as part of my cutover work. Thank you Valentin, keep up the great work!
@vdespa
@vdespa Год назад
Glad I could help You are welcome. Thank you for leaving a comment.
@TheTreborMedia
@TheTreborMedia Год назад
it's pretty helpful, I recommend check it out
@vdespa
@vdespa Год назад
Glad that it was helpful! You are welcome. Thank you for leaving a comment.
@saisanthosh7072
@saisanthosh7072 Год назад
Thanks, I did it with ur support..
@vdespa
@vdespa Год назад
Thank you too!
@dnya4512
@dnya4512 3 года назад
Mr. Valentin Despa, You are awesome. I have subscribed to your Udemy courses as well. Thank you. Keep it up.
@vdespa
@vdespa 3 года назад
Thanks 👍 I am glad it helped
@martinapetrova2682
@martinapetrova2682 3 года назад
You are amazing person!!! Such a great video!!!
@vdespa
@vdespa 3 года назад
Thank you, Martina.
@py8-bit
@py8-bit Год назад
Thank you! It's working fine..
@vdespa
@vdespa Год назад
You are welcome. Thank you for leaving a comment.
@krishvb4028
@krishvb4028 3 года назад
Thanks a lot. It made my day
@vdespa
@vdespa 3 года назад
My pleasure 😊
@snehalatakaranje8736
@snehalatakaranje8736 20 дней назад
Very informative. Thank you😊
@vdespa
@vdespa 19 дней назад
Glad it was helpful!
@victorgoltsov5132
@victorgoltsov5132 2 года назад
Thanks, Valentine! Your video helps as ussualy:)
@vdespa
@vdespa 2 года назад
I'm so glad that it was helpful.
@pratikjain3666
@pratikjain3666 2 года назад
U are a saviour
@vdespa
@vdespa 2 года назад
Thanks.
@vickyjadhav3800
@vickyjadhav3800 3 года назад
Very nicely explained
@vdespa
@vdespa 3 года назад
Thanks
@shwetam6708
@shwetam6708 3 года назад
Very well explained 👍
@vdespa
@vdespa 3 года назад
Glad it was helpful!
@mayurshankar3181
@mayurshankar3181 4 года назад
broooooooo!!! Thanks a Lottttt
@vdespa
@vdespa 4 года назад
You are welcome
@rezokobaidze8501
@rezokobaidze8501 3 года назад
thanks a lot
@vdespa
@vdespa 3 года назад
You are welcome 🙂
@javierolano7413
@javierolano7413 2 года назад
la mitad del sueldo de este mes va pa ti crack
@user-rb4nc1uv3c
@user-rb4nc1uv3c 7 месяцев назад
Thanks lot
@vdespa
@vdespa 7 месяцев назад
You are welcome. Thank you for leaving a comment.
@lv0192
@lv0192 3 года назад
Thanks
@vdespa
@vdespa 3 года назад
Sure. Thanks for watching!
@shankil2975
@shankil2975 Год назад
Hi Valentina.. This is what I was looking for - feed a bunch of input requests from external file. 2 follow up questions: 1) I presume the same concept works for CSV input as well.. Maybe some twaeks to concert CSV to valid JSON; similar to JSON.Stringify you used in this video 2) If I were to run this using Newman CLI and save the responses to a file (another video of yours), how does the file selection part work in CLI (in PM, you select the external file from a folder)?
@BANPHIM00
@BANPHIM00 3 года назад
Thank you so much for your tutorial! I am running into an issue where I have nested JSOn objects and not able to read it into the body, do you have any suggestions?
@sridharmurari3007
@sridharmurari3007 2 года назад
Even for nested objects I am unable to read any solution
@osotirov
@osotirov 4 года назад
Hi @Valentin Despa, Thanks a lot, very helpful! Much RESPECT bro!!! In case it's convenient to ask - what about testing part, i.e. how you perform verification of each object from the response?
@vdespa
@vdespa 4 года назад
Thank you for your comment. The testing part is covered in other videos. Let me know if you have a specific question that is not covered.
@osotirov
@osotirov 4 года назад
@Valentin Despa Thanks for your attention. If I have to be honest - you did not answer to my question. I don't ask how to perform verification, i.e testing on the responce in general. My question was specisic to this case you use a file where you have, let say in this way - few bodies at ones, i.e you perform sending of few requests at ones. This is different than general scenario - sending something in the body request and than, verify it in the response request, through pm.test... in 'test' tab at postman. I searched in your videos and found no answer . I found extremely useful and interesting things, but not what I was looking for - how to check exactly this 'multiple request' from your video. I may have missed it, I'm not arguing about that. If this is the case, please give a link in the comment. I will be infinitely grateful to you. I respect and honor a lot what you do, honestly, but I'm not happy with your answer. Sincerely bro - all the best.
@AppFanUAE
@AppFanUAE 2 года назад
thanks for the great help. how It can be executed with predefined file location, so instead of locating it manually I just want it to be executed with specific file, wither its stored locally or from the net?
@vdespa
@vdespa 2 года назад
You're welcome. You can automate this with Newman, but you can't set a predefined location.
@yohannjacob5491
@yohannjacob5491 3 года назад
HI i was wondering if we could pass and store the variable internally as a json file instead of taking a file from outside.
@vdespa
@vdespa 3 года назад
Can you shortly explain what exactly you are trying to do? I am not sure I have fully understood. Thanks!
@srivathsanrajagopal9442
@srivathsanrajagopal9442 2 года назад
Thanks for this tutorial. So If I have a query param in my post that value has to be populated from my json data, how can I set it
@vdespa
@vdespa 2 года назад
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.
@maheshbinayak9433
@maheshbinayak9433 2 года назад
Thanks mr Despa,is there any way to use a text file inplace of a json file?
@vdespa
@vdespa 2 года назад
You can use a JSON or a CSV file.
@kavitamehta5133
@kavitamehta5133 3 года назад
Hi Valentine, How can we proceed if we want to execute different request for different data under one collection in one go using json file
@vdespa
@vdespa 3 года назад
Have you looked into this? ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-fr7UpFNQbLw.html
@kollaanvesh3158
@kollaanvesh3158 Год назад
Hi @Valentin Despa ,i have a question. How can i get the json file from my local to the body of the request for individual request?
@vdespa
@vdespa Год назад
Postman can't read files from your filesystem and do that. You need a different approach, which relies on external tools to accomplish this.
@adityakirank
@adityakirank 3 года назад
Thx for your tutorials, they are very useful. Is it possible to provide json file with relative path+name as POST body? My json file has just 1 full large payload/object. It is not an array objects, I want to iterate against 1 request?
@vdespa
@vdespa 3 года назад
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.
@s1h2r345
@s1h2r345 2 года назад
Thanks for sharing this video. If in my Payload calling from external file, how to handle below scenario { "id":"{{externalOrderId}}", "language": null, "experience":2 }
@vdespa
@vdespa 2 года назад
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.
@anilkumaryadav106
@anilkumaryadav106 3 года назад
how do i count no of columns from a .csv data file in my prerequest. So that based on no of columns i will modify my array length in the request.
@vdespa
@vdespa 3 года назад
Try Object.keys(pm.iterationData.toObject()).length
@techieboie5659
@techieboie5659 3 года назад
Hello, I have downloaded latest postman desktop app and followed the steps in this video, but the request body is always null. is steps same in the desktop app also or something has changed recently?
@vdespa
@vdespa 3 года назад
It should work exactly the same. Check again your steps, maybe redo everything from scratch.
@janithdesilva7518
@janithdesilva7518 2 года назад
Hello Valentin. How can I get the text file or a base64 file just like this json file. Vould you please advise me on this?
@vdespa
@vdespa 2 года назад
Not sure what you mean. Please share more details.
@janithdesilva7518
@janithdesilva7518 2 года назад
@@vdespa Following is the request body of my API call. 👇 { “DomainName”: “string”, “SubDomain”: “string”, “CertificatePassword”: “string”, “Base64File”: “string” } This API call does is, creating a custom domain to a website using wildcard SSL. Instead of Wildcard SSL certificate I have to pass the Base64 file in the request body. But I can't pass the file into the request body. I would be really grateful if you could assit me on this. Best regards Janith from Sri Lanka 🙂
@vdespa
@vdespa 2 года назад
@@janithdesilva7518 You can't do this from Postman alone. You need a sever to read the file and make it available over HTTP. You make the request, save the data in a Postman variable and reuse it in this request.
@janithdesilva7518
@janithdesilva7518 2 года назад
@@vdespa okay I will try on this. Thankyou very much for the humble replies. I would return here if I ak stucked. Best regards Janith 🙂
@vdespa
@vdespa 2 года назад
Here is a possible solution: medium.com/p/7ab03913d9b0
@vinodpasi8021
@vinodpasi8021 2 года назад
Can we use a data file for indvidual request rather than postman collection?
@vdespa
@vdespa 2 года назад
It is not possible to use multiple files. You need to put all data in a single Json file.
@ganeshmanoharan1316
@ganeshmanoharan1316 3 года назад
Can we able to validate the request value is a string or number
@vdespa
@vdespa 3 года назад
You can use the object pm.request. See learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#scripting-with-request-data
@honeyclementina5125
@honeyclementina5125 4 года назад
If the use the above mentioned Pre-Request only Object is being passed and am getting 400 error. My payload is enclosed within a List how can i read it as List. Kindly could you pls tell me the function to convert to List as well. my payload example: [ { "appcode": "value", . . . } ]
@vdespa
@vdespa 4 года назад
It is hard to know what the problem is in this case. Join the Facebook community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
@Ankit-iq2ic
@Ankit-iq2ic Год назад
not working. can't set the request body.
@manjeet3000
@manjeet3000 3 года назад
How can i store API response(json) body data to an external file
@vdespa
@vdespa 3 года назад
See this: medium.com/@vdespa/postman-how-to-write-files-to-disk-5ee398624a42
@mishabindra3642
@mishabindra3642 4 года назад
Hi , nice video. Is it possible to provide the filename automatically ?
@vdespa
@vdespa 4 года назад
Thanks for your comment. What do you mean by "provide the filename automatically"?
@ashispal3423
@ashispal3423 4 года назад
@@vdespa is it possible to send a locally stored json schema file for validation? if yes please guide me. Thanks
@divyamoryani8779
@divyamoryani8779 2 года назад
Hi @Valentin Despa, Thank you for the detailed explanation, I have a Question: I have a .json file with all the data, It works perfectly when I try to run it using the collection Runner, however I want to pass the data.json file in the newman command to run it using the terminal. newman -run thecollection.json -e env.json.. how do I pass the data sheet? :)
@vdespa
@vdespa 2 года назад
Check the Newman documentation. If i remember correctly, it is --iteration-data
@divyamoryani8779
@divyamoryani8779 2 года назад
Hi @@vdespa , i tried the --iteration data , it worked.. But my scenario now is... I want to run only a specific iteration . Say i have 10 iterations in total. I want to run only 2nd one for a test. Im not able to do so. If i give --iteration data 2 - it runs 1st and 2nd. Please help out here.... Thank you!
@vdespa
@vdespa 2 года назад
@@divyamoryani8779 if you need only one iteration, don't use an external file.
@sridharmurari3007
@sridharmurari3007 2 года назад
Did u try and get how to do
@meghatiwari5225
@meghatiwari5225 3 года назад
Thanks Valentin for your guidance , I have two query here for reference this video scenario only. 1) I am getting Bad request in response and when i check body so {{jsonBody}} m looking same in body on collection runner. 2) If all request body as json external file we took in body so after that wat is the process to validate all fields which we get in response. Please share your email id if fine for you, I really need answer of above 2 queries. Thanks in advance.
@vdespa
@vdespa 3 года назад
It is hard to know what the problem is in this case. Join the Facebook community (see link in the description) and ask your question there. Consider adding more details, including screenshots. Thanks for understanding.
@jenandhutch
@jenandhutch 3 года назад
@@vdespa I have this problem too. the "jsonBody" is not getting populated (is null) so I get Bad Request. When I preview my json file in the test runner it looks good.
@jenandhutch
@jenandhutch 3 года назад
Ah, never mind! I just found the solution. I was missing the () on toObject.
Далее
My Puzzle Robot is 200x Faster Than a Human
21:21
Просмотров 6 млн
Learn JSON in 10 Minutes
12:00
Просмотров 3,1 млн
#Tutorials 22 || Postman Compare two JSON response
9:03
Advanced workflows (request chaining) with Postman
11:29
Loop request based on data from response in Postman
13:13
Compare two JSON responses with Postman
30:14
Просмотров 21 тыс.
Programatically change the request body in Postman
14:33