New route added for 'Control API' for retrieving route info

This commit is contained in:
Héctor Hurtado
2019-08-23 13:11:05 +02:00
parent fc760205ea
commit d564ff9206
3 changed files with 74 additions and 9 deletions
+37 -9
View File
@@ -98,7 +98,7 @@ TODO: Intro to Architecture
### Core Concepts
In this section we are going to define several concepts that will be used
In this section we are going to define several concepts that will be used
frequently throughout the spec.
@@ -127,7 +127,7 @@ whole lifetime of the server.
## Design Principles
* Kapow! implementations should follow a general principle of robustness: be
* Kapow! implementations should follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from others.
* We reuse conventions of well-established software projects, such as Docker.
* All requests and responses will leverage JSON as the data encoding method.
@@ -339,6 +339,34 @@ Removes the route identified by `:id`.
* **Notes**:
#### Retrieve route information
Retrieves the information about the route identified by `:id`.
* **URL**: `/routes/:id`
* **Method**: `GET`
* **Success Responses**:
* **Code**: `200 OK`<br />
**Content**:<br />
```json
{
"method": "GET",
"url_pattern": "/hello",
"entrypoint": null,
"command": "echo Hello World | response /body",
"index": 0,
"id": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx"
}
```
* **Error Responses**:
* **Code**: `404 Not Found`
* **Sample Call**:<br />
```sh
$ curl -X GET $KAPOW_URL/routes/ROUTE_1f186c92_f906_4506_9788_a1f541b11d0f
```
* **Notes**:
# HTTP Data API
It is the channel through which the actual HTTP data flows during the
@@ -425,12 +453,12 @@ following resource paths:
- Returned Value: `foo`
- Comment: That would provide read-only access to the request URL parameter `q`.
- Obtain the `Content-Type` header of the request.
- Scenario: A POST request with a JSON body and the header `Content-Type` set
- Scenario: A POST request with a JSON body and the header `Content-Type` set
to `application/json`.
- Key: `/request/headers/Content-Type`
- Access: Read-Only
- Returned Value: `application/json`
- Comment: That would provide read-only access to the value of the request
- Comment: That would provide read-only access to the value of the request
header `Content-Type`.
- Read a field from a form.
- Scenario: A request generated by submitting this form:<br />
@@ -446,7 +474,7 @@ following resource paths:
- Key: `/request/form/firstname`
- Access: Read-Only
- Returned Value: `Jane`
- Comment: That would provide read-only access to the value of the field
- Comment: That would provide read-only access to the value of the field
`firstname` of the form.
- Set the response status code.
- Scenario: A request is being attended.
@@ -462,7 +490,7 @@ following resource paths:
- Access: Write-Only
- Acceptable Value: Any string of bytes.
- Default Value: N/A
- Comment: For media types other than `application/octet-stream` you should
- Comment: For media types other than `application/octet-stream` you should
specify the appropiate `Content-Type` header.
**Note**: Parameters under `request` are read-only and, conversely, parameters under
@@ -471,12 +499,12 @@ following resource paths:
#### Get handler resource
Returns the value of the requested resource path, or an error if the resource
Returns the value of the requested resource path, or an error if the resource
path doesn't exist or is invalid.
* **URL**: `/handlers/{:handler_id}{:resource_path}`
* **Method**: `GET`
* **URL Params**: FIXME: We think that here should be options to cook the value
* **URL Params**: FIXME: We think that here should be options to cook the value
in some way, or get it raw.
* **Success Responses**:
* **Code**: `200 OK`<br />
@@ -497,7 +525,7 @@ path doesn't exist or is invalid.
* **URL**: `/handlers/{:handler_id}{:resource_path}`
* **Method**: `PUT`
* **URL Params**: FIXME: We think that here should be options to cook the value
* **URL Params**: FIXME: We think that here should be options to cook the value
in some way, or pass it raw.
* **Data Params**: Binary payload.
* **Success Responses**: