Examples vs Requests - adding mock responses to an existing collection

Hey @dan1,

Welcome to the Community and thank you for the question :trophy:

I think I’m following you but correct me if this is not the case - when you created the Mock Server you created 1 example for each of the 2 different routes (/hello and /goodbye)

That would mean that each request in your Collection would have a single example each, rather than 2 examples on a single route.

The first Example has been named as Default but this can be changed to anything you what by clicking on the name in the Examples dropdown menu.

The Mock Creation flow is different from the single Add Request flow, as this can be done as a separate action and is not tied into being used solely for the Mock Servers.

Picking things up from your empty hellohello request, If you go to the examples section again and press the Add Example button it will open up the Example builder.

This will already be pre-populated with the {{url}}/hellohello request URL. For the most basic case, all you need to do is add a Response Body and a Response Code.

Once you press the Save Example button, that will now be ready to use in your actual request and return the details you provided.

In the main request view, you should now see the hellohello example in the dropdown.

By hitting the Send button, the request will be sent to the Mock Server and it will return the example request that you previously created.

I hope that makes sense and you’re able to follow the flow that I listed. Any questions or If you need me to clarify any of the behaviours, don’t hesitate to ask. :slight_smile:

1 Like