Number of APIs: 14
The Mocks Server main distribution includes the admin-api plugin preinstalled. It provides a REST API allowing to interact with the server while it is running. You can use this collection to interact with the administration API and change the Mock Server settings while it is running, which may be very useful while using Mocks Server for development, for example. Using it, you can change the current Mocks Server collection, define custom route variants, change the mock delay, etc. Add it to your project dependencies using NPM: Add the next script to the Run the next NPM command: For further info about installing Mocks Server visit https://www.mocks-server.org/docs/installation The Qodex collection variables are set to match the default Mocks Server Admin API configuration, so you don't have to change anything until you changed the host or port options of the adminApi plugin. In that case, change the correspondent collection variables to fit your configuration. For example, if you changed the Change Change the Mocks Server administration API
Preface
Step 1: Install and start mocks-server
npm i -D @mocks-server/main
package.json
file:{
"scripts": {
"mocks" : "mocks-server"
}
}
npm run mocks
Step 2: Make your first API call
Extra: Configuration
plugins.adminApi.port
option to 3200, set the port
collection variable to 3200 as well.Example
plugins.adminApi.port
in Mocks Server:npm run mocks -- --plugins.adminApi.port=3200
port
variable in Qodex collection:
POST {{base_url}}/mock/custom-route-variants
DELETE {{base_url}}/mock/custom-route-variants
GET {{base_url}}/mock/collections
GET {{base_url}}/mock/variants/:variant_id
GET {{base_url}}/config
PATCH {{base_url}}/config
GET {{base_url}}/alerts
GET {{base_url}}/alerts/:alert_id
GET {{base_url}}/mock/routes
ENDPOINTS