Using Query Params

When working on a mock API, you will often need to configure your API in a way that will affect the working of the rest of your team. So to handle those scenarios, Mocklets enables you to control some of the configuration using query params while making the API request.

Currently, we allow users to configure response HTTP status and delay parameters by adding query params to their API calls.

Configure HTTP Status

You can request a specific HTTP status in response by adding x_response_status param to your api. So, if you api is https://api.mocklets.com/mock12675/pets which has its active response HTTP status set as 200, but you want it to return a 401 response, you just have to call

https://api.mocklets.com/mock12675/pets?x_response_status=401

Please note You need to add the requested status code to your api, otherwise it will return 404 NOT FOUND error.

Configure Response delay

User can add custom delay to the api request using query param without effecting the behavior of other team members using the same api. You need to add x_response_delay param to you api. So, if your api is https://api.mocklets.com/mock12675/pets and you want to set the delay as 15 seconds, you have to call

https://api.mocklets.com/mock12675/pets?x_response_delay=15

The maximum delay supported in 60 seconds, any value above it will be ignored and 60 second delay will be set for that request.

We are adding more configuration that can be managed using query params. Please stay tuned for more.

Last updated