# Create examples with scripting

**URL:** <https://community.postman.com/t/create-examples-with-scripting/37088>\
**Category:** Help Hub\
**Tags:** examples, mock, scripting\
**Created:** [July 11, 2022, 12:34pm UTC](https://community.postman.com/t/create-examples-with-scripting/37088 "2022-07-11T12:34:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![karelhusa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/karelhusa/32/12594_2.png) [@karelhusa](https://community.postman.com/u/karelhusa)\
**Post date:** [July 11, 2022, 12:34pm UTC](https://community.postman.com/t/create-examples-with-scripting/37088/1 "2022-07-11T12:34:33Z")

</div>

**Create examples with scripting**

I am looking for an option to create examples programatically.

The desired scenario:

1. Send a request to the API server.
2. Save a response as an example. Set the query param of the example.
3. Loop to step 1 (as long as the responses are available).
4. Set up a mock server with the stored examples.

 ![PostmanLooping2022-07-11_143241](https://us1.discourse-cdn.com/getpostman/original/2X/9/9f334dc1f0407c618de497ed40c62ceaccfd0f26.jpeg)

_I’ve already tried_:  
Up to now, I am only able to:

1. Store the responses programatically into environment variables (response1, response2 etc)
2. Set up the examples manually using {{reponse1}} in the response body
3. Set the example params manually.
4. Start the mock server.

I did a research of Collection SDK. SDK would help me to make a collection from scratch, but not sure how to use it in an existing collection, just to make small changes.
