Getting request examples via Postman API. Possible?

Hello everyone,

I’m trying to figure out how to get list of examples for collection via Postman API. Is it possible?

Thank you

Hey @kirzilla,

Welcome to the community! :wave:

If you’re after a list of example collections, that you can import into Postman - You could check out the Templates feature.

This can be found by pressing the orange +New button, in the top left of the app. Under the Templates section, you will find lots of awesome collections with example requests.

The Intro to writing tests - with examples is a great collection to start with, it has different example requests but also different examples of writing tests for your endpoints. :trophy:

Hey there! Thank you for quick answer!
Sorry, but I meant Postman API (Sorry for my enlish!).

Will this method https://docs.api.getpostman.com/#647806d5-492a-eded-1df6-6529b5dc685c return list of examples added to collection’s requests? It is unclear from examples provided in docs.

GET https://api.getpostman.com/collections/{{collection_uid}}

Thank you!

That’s cool - my bad. :slight_smile:

I’m not sure what you mean by list of examples added to collection’s requests?

The following requests will give you a different response - This would show you all the collections that you have:

GET https://api.getpostman.com/collections?apikey={{apikey}}

This will give you the details of a single collection when the collection_uid is added to the URL:

GET https://api.getpostman.com/collections/{{collection_uid}?apikey={{apikey}}

Is that what you were looking for?

Collection have requests, requests have examples with responses (see screenshot). Examples are used for documentation and mocking.

Is it possible to get list of examples added to request via Postman API?

Ok, I’ve tried requesting Postman REST API and yes, GET https://api.getpostman.com/collections/{{collection_uid}} will return information about request examples.

The Postman API doesn’t currently support getting the user define examples that are used with the mocks etc.