Create examples with scripting

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.

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.

1 Like