How to create postman collection dynamically through Java program

Hi everyone, I want to create postman collection through Java program .There is any API which I use ? How do I create dynamically collection and some get and post request through Java code . not from postman interface ? Thank you

Hey @supply-operator-2643, you can find the list of API on the below link which will help you create collection.

https://www.postman.com/postman/workspace/published-postman-templates/collection/631643-dac5eac9-148d-a32e-b76b-3edee9da28f7?action=share&creator=10404977

Cheers :cake:

1 Like

thank you sahuvikram but still I can’t figure out how to create program who hit the api and create it dynamically with passing fields,
for example I pass 2 fileds

1 id
2 name

and request method is post

so it will generate http://localhost:8080/create

Hi @supply-operator-2643 did you able to get a way around, I am looking for something similar, let me know in case you got any reference. Thanks

@manikas2

I’ve got to ask. Why do you want to do this?

If you are coding this in any programming language, surely you would just call the API directly.

Hi @michaelderekjones currently we are copying headers , body to postman for testing instead we are looking for a solution in java testcase
that will create a postman collection and we can just import it and test.

I sort of get that if your main UI testing is Java, but the amount of code you would need to write to do this including the error handling would be extreme. Which is sort of why you use Postman in the first place.

I don’t think you’ll find any examples apart from the link supplied previously as I don’t think it something that anyone has really tried. The only chance you have is if someone has done this before. You are basically creating a JSON structure, so perhaps that is what you need to Google. The collection and environment files are just JSON files at the end of the day.

API testing should come before UI testing, and they should be separate tests\libraries. Just in case you are mixing the two.

2 Likes

Hi @sahuvikramp,

Could you please highlight which collection of the mentioned link is useful for creating a Postman collection through java Code.