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.
You can request a specific HTTP status in response by adding
x_response_statusparam to your api. So, if you api is
https://api.mocklets.com/mock12675/petswhich has its active response HTTP status set as
200, but you want it to return a
401response, you just have to call
Please note You need to add the requested status code to your api, otherwise it will return
404 NOT FOUNDerror.
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_delayparam to you api. So, if your api is
https://api.mocklets.com/mock12675/petsand you want to set the delay as
15 seconds, you have to call
The maximum delay supported in
60 seconds, any value above it will be ignored and
60 seconddelay will be set for that request.
We are adding more configuration that can be managed using query params. Please stay tuned for more.