Each running mock server exposes an admin API that allows you to manage your environment. This API can be used to automate the management of your mock server, especially in a remote environment, without having to restart the application.
The admin API base endpoint is the same as the mock server URL with the /mockoon-admin
path appended.
For example, if your mock server is running on http://localhost:3000
, the admin API base endpoint will be http://localhost:3000/mockoon-admin
.
💡 The API prefix is not applied to the admin API base endpoint. If your API endpoints are accessible on http://localhost:3000/myprefix/{endpoint}
, the admin API base endpoint will still be http://localhost:3000/mockoon-admin
.
The admin API is enabled by default.
In the desktop application, the admin API cannot be disabled. However, you can disable it when running your mock with the CLI or the serverless library.
To disable the admin API when running your mock with the CLI, use the --disable-admin-api
flag:
Copymockoon-cli start --disable-admin-api -d ./mock.json
📘 Check the CLI dedicated documentation
To disable the admin API when running your mock with the serverless library, set the enableAdminApi
option to false
when building the MockoonServerless
instance:
Copyconst mockoonServerless = new mockoon.MockoonServerless(mockEnv, { enableAdminApi: false });
📘 Check the serverless library dedicated documentation
Currently, the admin API allows you to: