Document /routes get and append

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
pancho horrillo
2019-05-20 15:20:25 +02:00
parent 73f59045ec
commit 79d7e3be04
+109 -57
View File
@@ -118,78 +118,130 @@ respond to an external event (e.g. an incomming HTTP request).
Returns JSON data about the current routes. Returns JSON data about the current routes.
##### URL * **URL**
##### Method
##### URL Params
##### Data Params
##### Success Response
##### Error Response
##### Sample Call
##### Notes
#### Append a new route /routes
##### URL
##### Method * **Method**
##### URL Params
##### Data Params GET
##### Success Response
##### Error Response * **Success Response**
##### Sample Call
##### Notes * **Code**: 200<br />
**Content**: `{ TODO: maybe list of objects }`
* **Sample Call**
TODO
* **Notes**
Currently all routes are returned; in the future, a filter may be accepted.
#### Append route
Accepts JSON data that defines a new route to be appended to the current routes.
* **URL**
/routes
* **Method**
POST
* **Headers**
* **Content-Type**: application/json
* **Data Params**
* **Content**:
```json
{
"method": "GET",
"url_pattern": "/hello",
"entrypoint": null,
"command": "echo Hello World | response /body"
}
```
* **Success Response**
* **Code**: `200 OK`<br />
**Header**: `Content-Type: application/json`<br />
**Content**: `"ROUTE_8ed01c48_bf23_455a_8186_a1df7ab09e48"`
* **Error Response**
* **Code**: `400 Bad Request`<br />
**Header**: `Content-Type: application/json`<br />
**Content**: `{ "error": "Malformed JSON." }`
* **Code**: `422 Unprocessable Entity`<br />
**Header**: `Content-Type: application/json`<br />
**Content**: `{ "error": "Mandatory field(s) not provided." }`
* **Sample Call**
TODO
* **Notes**
TODEL if NIL
#### Insert a route #### Insert a route
##### URL * **URL**
##### Method * **Method**
##### URL Params * **URL Params**
##### Data Params * **Data Params**
##### Success Response * **Success Response**
##### Error Response * **Error Response**
##### Sample Call * **Sample Call**
##### Notes * **Notes**
#### Delete a route #### Delete a route
##### URL * **URL**
##### Method * **Method**
##### URL Params * **URL Params**
##### Data Params * **Data Params**
##### Success Response * **Success Response**
##### Error Response * **Error Response**
##### Sample Call * **Sample Call**
##### Notes * **Notes**
### Handlers ### Handlers
#### Get the value for a handler key #### Get the value for a handler key
##### URL * **URL**
##### Method * **Method**
##### URL Params * **URL Params**
##### Data Params * **Data Params**
##### Success Response * **Success Response**
##### Error Response * **Error Response**
##### Sample Call * **Sample Call**
##### Notes * **Notes**
#### Overwrite the value for a handler key #### Overwrite the value for a handler key
##### URL * **URL**
##### Method * **Method**
POST POST
##### URL Params * **URL Params**
##### Data Params * **Data Params**
##### Success Response * **Success Response**
##### Error Response * **Error Response**
##### Sample Call * **Sample Call**
##### Notes * **Notes**
#### Append to the value for a handler key #### Append to the value for a handler key
##### URL * **URL**
##### Method * **Method**
PUT PUT
##### URL Params * **URL Params**
##### Data Params * **Data Params**
##### Success Response * **Success Response**
##### Error Response * **Error Response**
##### Sample Call * **Sample Call**
##### Notes * **Notes**
## Usage Example ## Usage Example