diff --git a/docs/api/agents/create.md b/docs/api/agents/create.md index 34a1f2ec1..c6f685974 100644 --- a/docs/api/agents/create.md +++ b/docs/api/agents/create.md @@ -24,7 +24,7 @@ If successful this method creates an Agent resource. **Sample Call** ```json -POST /api/v1beta1/agents +POST /api/{apiversion}/agents { "apiVersion": "v1beta1", "kind": "Agent", diff --git a/docs/api/agents/get.md b/docs/api/agents/get.md index e4beb8968..4c8ffa951 100644 --- a/docs/api/agents/get.md +++ b/docs/api/agents/get.md @@ -25,7 +25,7 @@ If successful this method returns an Agent resource. **Sample Call** ```json -GET /api/v1beta1/agents/ag3f77f6 +GET /api/{apiversion}/agents/ag3f77f6 { } diff --git a/docs/api/agents/list.md b/docs/api/agents/list.md index a690b1bd1..f1fe5f079 100644 --- a/docs/api/agents/list.md +++ b/docs/api/agents/list.md @@ -29,7 +29,7 @@ If successful this method returns a list of Agent resources. **Sample Call** ```json -GET /api/v1beta1/agents +GET /api/{apiversion}/agents { } diff --git a/docs/api/config/get.md b/docs/api/config/get.md new file mode 100644 index 000000000..19fc688fa --- /dev/null +++ b/docs/api/config/get.md @@ -0,0 +1,40 @@ +This method returns the servers' configuration. + +**URL** + +`/system/config` + +**Method** + +`GET` + +**Parameters** + +| Parameter Name | Type | Value | Description +| --- | :--------- | :--------- | :--------- | +| full | query | boolean | If set to `true` it will return a merged configuration between defaults and explicit values| + +**Request body** + +Do not supply a request body with this method. + +**Response** + +If successful this method returns the current configuration from the server. + +**Sample Call** + +```json +GET /api/{apiversion}/system/config +{ + +} + +HTTP/1.1 200 OK +{ + "status": 200, + "message": "Successful request", + "data": { + ... + } +} diff --git a/docs/api/config/update.md b/docs/api/config/update.md new file mode 100644 index 000000000..46b506294 --- /dev/null +++ b/docs/api/config/update.md @@ -0,0 +1,41 @@ +This method updates the servers' configuration. + +**URL** + +`/system/config` + +**Method** + +`PUT` + +**Parameters** + +This method does not receive any parameters. + +**Request body** + +A file containing the [servers' configuration](/configuration/general) in `json` format. + +**Response** + +The changes will take effect on the next time the instance restart. + +**Sample Call** + +```json +PUT /api/{apiversion}/config +{ + "apiVersion": "v1beta1", + "spec": { + "dataSource": { + "provider": "redis_data_provider" + } + } +} + +HTTP/1.1 200 OK +{ + "status": "200", + "message": "Successful request" +} +``` diff --git a/docs/api/domains/create.md b/docs/api/domains/create.md index f41fc0dc5..76fc1a8d7 100644 --- a/docs/api/domains/create.md +++ b/docs/api/domains/create.md @@ -23,7 +23,7 @@ If successful this method creates a Domain resource. **Sample Call** ```json -POST /api/v1beta1/domains +POST /api/{apiversion}/domains { "apiVersion": "v1beta1", "kind": "Domain", diff --git a/docs/api/domains/get.md b/docs/api/domains/get.md index 7c1e31c1c..c6f517de7 100644 --- a/docs/api/domains/get.md +++ b/docs/api/domains/get.md @@ -25,7 +25,7 @@ If successful this method returns a Domain resource. **Sample Call** ```json -GET /api/v1beta1/domains/dm6c87r2 +GET /api/{apiversion}/domains/dm6c87r2 { } diff --git a/docs/api/domains/list.md b/docs/api/domains/list.md index 28d82652d..f5b7c10e1 100644 --- a/docs/api/domains/list.md +++ b/docs/api/domains/list.md @@ -29,7 +29,7 @@ If successful this method returns a list of Domain resources. **Sample Call** ```json -GET /api/v1beta1/domains +GET /api/{apiversion}/domains { } diff --git a/docs/api/gateways/create.md b/docs/api/gateways/create.md index c94307ed1..47e830c1c 100644 --- a/docs/api/gateways/create.md +++ b/docs/api/gateways/create.md @@ -23,7 +23,7 @@ If successful this method creates a Gateway resource. **Sample Call** ```json -POST /api/v1beta1/gateways +POST /api/{apiversion}/gateways { "apiVersion": "v1beta1", "kind": "Gateway", diff --git a/docs/api/gateways/get.md b/docs/api/gateways/get.md index b7aaba9a0..8f342db55 100644 --- a/docs/api/gateways/get.md +++ b/docs/api/gateways/get.md @@ -25,7 +25,7 @@ If successful this method returns a Gateway resource. **Sample Call** ```json -GET /api/v1beta1/gateways/gw5c77t2 +GET /api/{apiversion}/gateways/gw5c77t2 { } diff --git a/docs/api/gateways/list.md b/docs/api/gateways/list.md index 89badfc1a..013e9027b 100644 --- a/docs/api/gateways/list.md +++ b/docs/api/gateways/list.md @@ -29,7 +29,7 @@ If successful this method returns a list of Gateways resources. **Sample Call** ```json -GET /api/v1beta1/gateways +GET /api/{apiversion}/gateways { } diff --git a/docs/api/numbers/create.md b/docs/api/numbers/create.md index 864b2a0dc..4113081be 100644 --- a/docs/api/numbers/create.md +++ b/docs/api/numbers/create.md @@ -24,7 +24,7 @@ If successful this method creates a Number. **Sample Call** ```json -POST /api/v1beta1/numbers +POST /api/{apiversion}/numbers { "apiVersion": "v1beta1", "kind": "Number", diff --git a/docs/api/numbers/get.md b/docs/api/numbers/get.md index 96fd1a236..bd66dfbdf 100644 --- a/docs/api/numbers/get.md +++ b/docs/api/numbers/get.md @@ -25,7 +25,7 @@ If successful this method returns a Number. **Sample Call** ```json -GET /api/v1beta1/numbers/dd50baa4 +GET /api/{apiversion}/numbers/dd50baa4 { } diff --git a/docs/api/numbers/list.md b/docs/api/numbers/list.md index e77a9fcb7..77edb6d6a 100644 --- a/docs/api/numbers/list.md +++ b/docs/api/numbers/list.md @@ -29,7 +29,7 @@ If successful this method returns a list of Numbers. **Sample Call** ```json -GET /api/v1beta1/numbers +GET /api/{apiversion}/numbers { } diff --git a/docs/api/peers/create.md b/docs/api/peers/create.md index b35b346da..cb736494b 100644 --- a/docs/api/peers/create.md +++ b/docs/api/peers/create.md @@ -23,7 +23,7 @@ If successful this method creates a Peer resource. **Sample Call** ```json -POST /api/v1beta1/peers +POST /api/{apiversion}/peers { "apiVersion": "v1beta1", "kind": "Peer", diff --git a/docs/api/peers/get.md b/docs/api/peers/get.md index 85de7c010..a3bd8c824 100644 --- a/docs/api/peers/get.md +++ b/docs/api/peers/get.md @@ -25,7 +25,7 @@ If successful this method returns a Peer resource. **Sample Call** ```json -GET /api/v1beta1/peers/pr2c77f4 +GET /api/{apiversion}/peers/pr2c77f4 { } diff --git a/docs/api/peers/list.md b/docs/api/peers/list.md index a59dcad39..72bb915bc 100644 --- a/docs/api/peers/list.md +++ b/docs/api/peers/list.md @@ -29,7 +29,7 @@ If successful this method returns a list of Peer resources. **Sample Call** ```json -GET /api/v1beta1/peers +GET /api/{apiversion}/peers { } diff --git a/docs/api/status/get.md b/docs/api/status/get.md new file mode 100644 index 000000000..5241d8d18 --- /dev/null +++ b/docs/api/status/get.md @@ -0,0 +1,39 @@ +Pings an instance of Routr engine. + +**URL** + +`/system/status` + +**Method** + +`GET` + +**Parameters** + +This method does not receive any parameters. + +**Request body** + +Do not supply a request body with this method. + +**Response** + +If successful this method will return a `status = 200`. A client implementing +this method can assumed that no answer or a bad answer means that the server +us down or "unhealthy." + +**Sample Call** + +```json +GET /api/{apiversion}/system/status +{ + +} + +HTTP/1.1 200 OK +{ + "status": "200", + "message": "Successful request", + "data": "up" +} +``` diff --git a/docs/api/sys/status.md b/docs/api/status/update.md similarity index 80% rename from docs/api/sys/status.md rename to docs/api/status/update.md index 183676807..df75eca7a 100644 --- a/docs/api/sys/status.md +++ b/docs/api/status/update.md @@ -13,7 +13,7 @@ This method returns information about the server. | Parameter Name | Type | Value | Description | --- | :--------- | :--------- | :--------- | | status | path | string | This accepts either `down` or `restarting` parameters | -| filter | now | boolean | If set to `true` it will not wait for current calls to finish | +| now | query | boolean | If set to `true` it will not wait for current calls to finish | **Request body** @@ -26,7 +26,7 @@ If successful this method causes the server to change its status. **Sample Call** ```json -POST /api/v1beta1/system/status/reload +POST /api/{apiversion}/system/status/reload { } diff --git a/docs/api/sys/info.md b/docs/api/sys/info.md index b5c64e6e7..a04d6fec0 100644 --- a/docs/api/sys/info.md +++ b/docs/api/sys/info.md @@ -23,7 +23,7 @@ If successful this method returns relevant information about the server. **Sample Call** ```json -GET /api/v1beta1/system/info +GET /api/{apiversion}/system/info { } diff --git a/docs/api/sys/logs.md b/docs/api/sys/logs.md index 823627c30..a376b9f12 100644 --- a/docs/api/sys/logs.md +++ b/docs/api/sys/logs.md @@ -23,7 +23,7 @@ If successful this method returns logging information from the server. **Sample Call** ```json -GET /api/v1beta1/system/logs +GET /api/{apiversion}/system/logs { } diff --git a/mkdocs.yml b/mkdocs.yml index 7990a4ed1..df65f0a92 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -75,8 +75,13 @@ nav: - get: api/numbers/get.md - list: api/numbers/list.md - update: api/numbers/update.md + - Configuration: + - Get: api/config/get.md + - Update: api/config/update.md - System: - - Status: api/sys/status.md + - Status: + - Get: api/status/get.md + - Update: api/status/update.md - Info: api/sys/info.md - Logs: api/sys/logs.md - Guides: diff --git a/mod/rest/rest.js b/mod/rest/rest.js index 800f93312..60dc56712 100644 --- a/mod/rest/rest.js +++ b/mod/rest/rest.js @@ -84,7 +84,7 @@ class Rest { res.status(401) res.body('{"status": "401", "message":"Unauthorized"}') } else { - LOG.error(e.getMessage()) + //LOG.error(e.getMessage()) res.status(500) res.body('{"status": "500", "message":"Internal server error"}') }