Package Exports
- @mocks-server/plugin-admin-api
- @mocks-server/plugin-admin-api/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mocks-server/plugin-admin-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Mocks Server Plugin Admin Api
Plugin for Mocks Server that provides an API REST that allows to change the current mock, change delay time, and another Mocks Server options.
This is very useful when running acceptance tests, as you can change the current mock simply with a HTTP request in the before method of your tests, for example.
A client for the administration api is also distributed as a separated package: @mocks-server/admin-api-client.
Usage
This plugin is included in the main distribution of the Mocks Server project, so you can refer to the official documentation website.
Options
adminApiPath(String): Path for the administration api. Default is/admin. You should change it only in case there is any conflict with the api you are mocking.
Read more about how to set options in Mocks Server here.
API Resources
Available api resources are:
GET/admin/aboutReturns "plugin-admin-api" information.- Response body example:
{ "version": "1.2.0" }
- Response body example:
GET/admin/mocksReturns mocks.GET/admin/mocks/:idReturns a specific mock.GET/admin/routesReturns routes collection.GET/admin/routes/:idReturns a specific route.GET/admin/routes-variantsReturns routes variants collection.GET/admin/routes-variants/:idReturns a specific route variant.GET/admin/mock-custom-routes-variantsReturns an array of currently custom routes variants ids.POST/admin/mock-custom-routes-variantsDefines a route variant to be used by current mock.- Request body example:
{ "id": "users:error" }
- Request body example:
DELETE/admin/mock-custom-routes-variantsRestore routes variants to those defined in current mock.GET/admin/settingsReturns current server settings.- Response body example:
{ "delay": 0, mock: "foo-mock", path: "mocks" }
- Response body example:
PATCH/admin/settingsChanges current server settings.- Request body example:
{ "delay": 3000 }
- Request body example:
GET/admin/alertsReturns current alerts.GET/admin/alerts/:idReturns a specific alert. The alertidis equivalent to the alertcontext(read the developing plugins chapter for further info about alerts).
Contributing
Contributors are welcome. Please read the contributing guidelines and code of conduct.
