-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from ReputationVIP/add-read-the-doc
Add read the doc
- Loading branch information
Showing
5 changed files
with
1,486 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.. _API: | ||
|
||
=== | ||
API | ||
=== | ||
|
||
Mockservr exposes an HTTP API which allow to get information about current endpoints, and to update them if needed. | ||
This API is available through HTTP queries on `http://localhost:4580` (the API is exposed through the port 4580 of | ||
the Mockservr's container). | ||
|
||
------------- | ||
API Endpoints | ||
------------- | ||
|
||
All endpoints are JSON endpoints (`Content-Type: application/json`) and must be prefixed with `/api`. | ||
|
||
`/api` endpoint | ||
=============== | ||
|
||
`GET` method | ||
~~~~~~~~~~~~ | ||
|
||
The response is an object with a single attribute `httpEndpoints`, it contains the number of endpoints currently served | ||
by Mockservr. | ||
|
||
`/api/http-endpoints` endpoint | ||
============================== | ||
|
||
`GET` Method | ||
~~~~~~~~~~~~ | ||
|
||
The response is a collection of all HTTP endpoints cuurrently served by Mockservr. The response includes the internal | ||
ID of the endpoint and the source (mock file or API). | ||
|
||
`POST` method | ||
~~~~~~~~~~~~~ | ||
|
||
It expects a JSON body as defined in :ref:`http_mocking`, defining an endpoint with a Request and a Response. | ||
|
||
The response contains the newly created endpoint with its ID and source. If any error occurred, the response is an | ||
HTTP 400 response with a json object that contains all encountered errors. | ||
|
||
`/api/http-endpoints/:id` endpoint | ||
================================== | ||
|
||
`GET` Method | ||
~~~~~~~~~~~~ | ||
|
||
The response is an object defining the endpoint corresponding to the given `:id`. | ||
|
||
`DELETE` method | ||
~~~~~~~~~~~~~ | ||
|
||
Deletes the endpoint from Mockservr. The response is an HTTP 204 response. If any error occurred, the response is an | ||
HTTP 400 response with a json object that contains all encountered errors. | ||
|
||
.. note:: | ||
`DELETE` method does not delete the mock file, if the target endpoint is defined in a mock file. |
Oops, something went wrong.