# Automate creation of mock server out of collection

**URL:** <https://community.postman.com/t/automate-creation-of-mock-server-out-of-collection/35978>\
**Category:** Help Hub\
**Created:** [June 6, 2022, 2:57pm UTC](https://community.postman.com/t/automate-creation-of-mock-server-out-of-collection/35978 "2022-06-06T14:57:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![supply-technologist2](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@supply-technologist2](https://community.postman.com/u/supply-technologist2)\
**Post date:** [June 6, 2022, 2:57pm UTC](https://community.postman.com/t/automate-creation-of-mock-server-out-of-collection/35978/1 "2022-06-06T14:57:45Z")

</div>

I have a collection with almost 500 requests I want to create mock server out of them I don’t want to save each request manually as an example. Can I do it using some API or run complete collection and save all requests as an example?

_How I found the problem_:

_I’ve already tried_:

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [June 6, 2022, 6:20pm UTC](https://community.postman.com/t/automate-creation-of-mock-server-out-of-collection/35978/2 "2022-06-06T18:20:33Z")

</div>

Hi @supply-technologist2

I’m fairly new to mock servers but I don’t know of any automated way of creating examples.

The only suggestion I could offer is that you export the collection as JSON and write a script to add the examples in that way.

---

<div class="post-metadata">

**Author:** ![philimmo](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@philimmo](https://community.postman.com/u/philimmo)\
**Post date:** [August 3, 2022, 12:51pm UTC](https://community.postman.com/t/automate-creation-of-mock-server-out-of-collection/35978/3 "2022-08-03T12:51:57Z")

</div>

I’m very new to Postman and was also looking for a way to programmatically adding examples to a collection and then create a mock server from the collection. In your answer you advise to write a script to create the examples but therefore we would need an API endpoint from Postman that allows the creation of examples, I suppose? Unfortunately I have not been able to find such an endpoint.

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [August 3, 2022, 6:07pm UTC](https://community.postman.com/t/automate-creation-of-mock-server-out-of-collection/35978/4 "2022-08-03T18:07:41Z")

</div>

To clarify my comment, I meant to write a script outside of Postman that altered the JSON file.

If you export your collection you would see the structure of the examples within the JSON;

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/d/0d90435bb34823c00a02719341a80bd890820953.png)

These are stored in the response array. And I would think that new examples could be programmatically created and pushed to the array.
