diff --git a/docs/api-reference/organizations/create-an-api-client.md b/docs/api-reference/organizations/create-an-api-client.md index 4ee9dcb..25bf2f7 100644 --- a/docs/api-reference/organizations/create-an-api-client.md +++ b/docs/api-reference/organizations/create-an-api-client.md @@ -45,6 +45,7 @@ curl -X POST http://api.discue.io/v1/api_clients \ -H 'Accept: application/json' \ -H 'X-API-KEY: API_KEY' \ -d '{ + "id": "5bc2be68-7498-4853-aa64-4be0ca62934e", "name": "example.com/dev" }' ``` @@ -55,6 +56,7 @@ curl -X POST http://api.discue.io/v1/api_clients \ ```javascript const body = { + "id": "5bc2be68-7498-4853-aa64-4be0ca62934e", "name": "example.com/dev" } @@ -123,6 +125,7 @@ func main() { ```json { + "id": "5bc2be68-7498-4853-aa64-4be0ca62934e", "name": "example.com/dev" } ``` @@ -133,9 +136,27 @@ func main() { |pretty|query|boolean| ❌ |Return the response pretty printed| |body|body|[ApiClient](#schemaapiclient)| ❌ |none| |» name|body|string| ❌ |none| +|» id|body|[ResourceId](#resourceid)| ❌ |none| ## Responses +::: tip 200 Response +::: + +```json +{ + "api_client": { + "id": "5bc2be68-7498-4853-aa64-4be0ca62934e", + "name": "example.com/dev" + }, + "_links": { + "self": { + "href": "https://api.discue.io/api_clients/5bc2be68-7498-4853-aa64-4be0ca62934e" + } + } +} +``` + ::: tip 400 Response ::: @@ -288,7 +309,7 @@ func main() { |Status|Meaning|Description|Schema| |---|---|---|---| -|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|No Content|None| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[CreateApiClientResponse](#createapiclientresponse)| |400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request|Inline| |401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|Inline| |402|[Payment Required](https://tools.ietf.org/html/rfc7231#section-6.5.2)|Payment Required|Inline| diff --git a/docs/api-reference/organizations/update-an-api-client.md b/docs/api-reference/organizations/update-an-api-client.md new file mode 100644 index 0000000..e088d85 --- /dev/null +++ b/docs/api-reference/organizations/update-an-api-client.md @@ -0,0 +1,328 @@ +--- +title: discue scheduling and queueing API v0.1.0 +language_tabs: + - shell: curl + - javascript: JavaScript + - python: Python + - go: Go +toc_footers: [] +includes: [] +api: + method: put + path: /api_clients/{api_client_id} + name: Update an api client + +--- + +# Update an api client + +

+PUT /api_clients/{api_client_id} +

+ +**Update an api client**. + + In this context an api client and an organization can be used synonymously. + +::: tip Authentication +**The target organization for this request will be determined by the supplied access token.** + +As a prerequisite you need to **[create an account](https://www.discue.io/registration/create-account)** and follow +the onboarding process to also **create an organizatio**n and **an API key**. + +See also: [Authentication](/getting-started/#prerequisites). +::: + +## Examples + + +```shell +curl -X PUT http://api.discue.io/v1/api_clients/{api_client_id} \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'X-API-KEY: API_KEY' \ + -d '{ + "id": "5bc2be68-7498-4853-aa64-4be0ca62934e", + "name": "example.com/dev" +}' +``` + + + + + +```javascript +const body = { + "id": "5bc2be68-7498-4853-aa64-4be0ca62934e", + "name": "example.com/dev" +} + +const headers = { + 'Content-Type':'application/json', + 'Accept':'application/json', + 'X-API-KEY':'API_KEY' +} + +const response = await fetch('http://api.discue.io/v1/api_clients/{api_client_id}', { + method: 'PUT', body, headers +}) + +const body = await response.json() +``` + + + + + +```python +import requests +headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'X-API-KEY': 'API_KEY' +} + +r = requests.put('http://api.discue.io/v1/api_clients/{api_client_id}', headers = headers) +``` + + + + + +```go +package main + +import ( + "bytes" + "net/http" +) + +func main() { + + headers := map[string][]string{ + "Content-Type": []string{"application/json"}, + "Accept": []string{"application/json"}, + "X-API-KEY": []string{"API_KEY"}, + } + + data := bytes.NewBuffer([]byte{jsonReq}) + req, err := http.NewRequest("PUT", "http://api.discue.io/v1/api_clients/{api_client_id}", data) + req.Header = headers + + client := &http.Client{} + resp, err := client.Do(req) +} +``` + + + + + +## Body + +```json +{ + "id": "5bc2be68-7498-4853-aa64-4be0ca62934e", + "name": "example.com/dev" +} +``` + +## Parameters +|Name|In|Type|Required|Description| +|---|---|---|---|---| +|api_client_id|path|string(uuid)|✔|none| +|pretty|query|boolean| ❌ |Return the response pretty printed| +|body|body|[ApiClient](#schemaapiclient)| ❌ |none| +|» name|body|string| ❌ |none| +|» id|body|[ResourceId](#resourceid)| ❌ |none| + +## Responses + +::: tip 200 Response +::: + +```json +{ + "api_client": { + "id": "5bc2be68-7498-4853-aa64-4be0ca62934e", + "name": "example.com/dev" + }, + "_links": { + "self": { + "href": "https://api.discue.io/api_clients/5bc2be68-7498-4853-aa64-4be0ca62934e" + } + } +} +``` + +::: tip 400 Response +::: + +```json +{ + "title": "Bad Request", + "status": 400 +} +``` + +::: tip 401 Response +::: + +```json +{ + "title": "Unauthorized", + "status": 401 +} +``` + +::: tip 402 Response +::: + +```json +{ + "title": "Payment Required", + "status": 402 +} +``` + +::: tip 403 Response +::: + +```json +{ + "title": "Forbidden", + "status": 403 +} +``` + +::: tip 404 Response +::: + +```json +{ + "title": "Not Found", + "status": 404 +} +``` + +::: tip 405 Response +::: + +```json +{ + "title": "Method Not Allowed", + "status": 405 +} +``` + +::: tip 406 Response +::: + +```json +{ + "title": "Not Acceptable", + "status": 406 +} +``` + +::: tip 409 Response +::: + +```json +{ + "title": "Conflict", + "status": 409 +} +``` + +::: tip 415 Response +::: + +```json +{ + "title": "Unsupported Media Type", + "status": 415 +} +``` + +::: tip 422 Response +::: + +```json +{ + "title": "Unprocessable Entity", + "status": 422 +} +``` + +::: tip 423 Response +::: + +```json +{ + "title": "Locked", + "status": 423 +} +``` + +::: tip 429 Response +::: + +```json +{ + "title": "Too Many Requests", + "status": 429 +} +``` + +::: tip 500 Response +::: + +```json +{ + "title": "Internal Server Error", + "status": 500 +} +``` + +::: tip 501 Response +::: + +```json +{ + "title": "Not Implemented", + "status": 501 +} +``` + +::: tip 503 Response +::: + +```json +{ + "title": "Service Unavailable", + "status": 503 +} +``` + +|Status|Meaning|Description|Schema| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Ok|[CreateApiClientResponse](#createapiclientresponse)| +|400|[Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)|Bad Request|Inline| +|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|Inline| +|402|[Payment Required](https://tools.ietf.org/html/rfc7231#section-6.5.2)|Payment Required|Inline| +|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Forbidden|Inline| +|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|Not Found|Inline| +|405|[Method Not Allowed](https://tools.ietf.org/html/rfc7231#section-6.5.5)|Method Not Allowed|Inline| +|406|[Not Acceptable](https://tools.ietf.org/html/rfc7231#section-6.5.6)|Not Acceptable|Inline| +|409|[Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8)|Conflict|Inline| +|415|[Unsupported Media Type](https://tools.ietf.org/html/rfc7231#section-6.5.13)|Unsupported Media Type|Inline| +|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Unprocessable Entity|Inline| +|423|[Locked](https://tools.ietf.org/html/rfc2518#section-10.4)|Locked|Inline| +|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|Too Many Requests|Inline| +|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Internal Server Error|Inline| +|501|[Not Implemented](https://tools.ietf.org/html/rfc7231#section-6.6.2)|Not Implemented|Inline| +|503|[Service Unavailable](https://tools.ietf.org/html/rfc7231#section-6.6.4)|Service Unavailable|Inline| + +--- + diff --git a/docs/api-reference/queue-messages/add-a-message-to-a-queue.md b/docs/api-reference/queue-messages/add-a-message-to-a-queue.md index c5c11b7..d7f73b5 100644 --- a/docs/api-reference/queue-messages/add-a-message-to-a-queue.md +++ b/docs/api-reference/queue-messages/add-a-message-to-a-queue.md @@ -55,6 +55,7 @@ curl -X POST http://api.discue.io/v1/queues/{queue_id}/messages \ -H 'Accept: application/json' \ -H 'X-API-KEY: API_KEY' \ -d '{ + "name": "string", "data": "{ \"userId\": \"481512342\" }" }' ``` @@ -65,6 +66,7 @@ curl -X POST http://api.discue.io/v1/queues/{queue_id}/messages \ ```javascript const body = { + "name": "string", "data": "{ \"userId\": \"481512342\" }" } @@ -133,6 +135,7 @@ func main() { ```json { + "name": "string", "data": "{ \"userId\": \"481512342\" }" } ``` @@ -143,6 +146,7 @@ func main() { |queue_id|path|string(uuid)|✔|Id of the target queue| |pretty|query|boolean| ❌ |Return the response pretty printed| |body|body|[CreateMessageRequest](#schemacreatemessagerequest)| ❌ |none| +|» name|body|[ResourceName](#resourcename)| ❌ |none| |» data|body|[MessageData](#messagedata)|✔|none| ## Responses diff --git a/docs/api-reference/queues/create-a-queue.md b/docs/api-reference/queues/create-a-queue.md index 44fe448..cdd02c7 100644 --- a/docs/api-reference/queues/create-a-queue.md +++ b/docs/api-reference/queues/create-a-queue.md @@ -56,7 +56,44 @@ curl -X POST http://api.discue.io/v1/queues \ -H 'Accept: application/json' \ -H 'X-API-KEY: API_KEY' \ -d '{ - "name": "myapp.io/deletion-request-queue" + "name": "myapp.io/deletion-request-queue", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } }' ``` @@ -66,7 +103,44 @@ curl -X POST http://api.discue.io/v1/queues \ ```javascript const body = { - "name": "myapp.io/deletion-request-queue" + "name": "myapp.io/deletion-request-queue", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } } const headers = { @@ -134,7 +208,44 @@ func main() { ```json { - "name": "myapp.io/deletion-request-queue" + "name": "myapp.io/deletion-request-queue", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } } ``` @@ -144,6 +255,7 @@ func main() { |pretty|query|boolean| ❌ |Return the response pretty printed| |body|body|[UpdateQueueRequest](#schemaupdatequeuerequest)|✔|none| |» name|body|string| ❌ |none| +|» schema|body|[QueueMessageSchema](#queuemessageschema)| ❌ |none| ## Responses @@ -154,7 +266,44 @@ func main() { { "queue": { "id": "string", - "name": "string" + "name": "string", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } }, "_links": { "self": { diff --git a/docs/api-reference/queues/get-a-queue-by-id.md b/docs/api-reference/queues/get-a-queue-by-id.md index 804af01..8d658d0 100644 --- a/docs/api-reference/queues/get-a-queue-by-id.md +++ b/docs/api-reference/queues/get-a-queue-by-id.md @@ -125,7 +125,44 @@ func main() { { "queue": { "id": "string", - "name": "string" + "name": "string", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } }, "_links": { "self": { diff --git a/docs/api-reference/queues/update-a-queue-by-id.md b/docs/api-reference/queues/update-a-queue-by-id.md index a241bdc..71ac496 100644 --- a/docs/api-reference/queues/update-a-queue-by-id.md +++ b/docs/api-reference/queues/update-a-queue-by-id.md @@ -46,7 +46,44 @@ curl -X PUT http://api.discue.io/v1/queues/{queue_id} \ -H 'Accept: application/json' \ -H 'X-API-KEY: API_KEY' \ -d '{ - "name": "myapp.io/deletion-request-queue" + "name": "myapp.io/deletion-request-queue", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } }' ``` @@ -56,7 +93,44 @@ curl -X PUT http://api.discue.io/v1/queues/{queue_id} \ ```javascript const body = { - "name": "myapp.io/deletion-request-queue" + "name": "myapp.io/deletion-request-queue", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } } const headers = { @@ -124,7 +198,44 @@ func main() { ```json { - "name": "myapp.io/deletion-request-queue" + "name": "myapp.io/deletion-request-queue", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } } ``` @@ -135,6 +246,7 @@ func main() { |pretty|query|boolean| ❌ |Return the response pretty printed| |body|body|[UpdateQueueRequest](#schemaupdatequeuerequest)|✔|none| |» name|body|string| ❌ |none| +|» schema|body|[QueueMessageSchema](#queuemessageschema)| ❌ |none| ## Responses @@ -145,7 +257,44 @@ func main() { { "queue": { "id": "string", - "name": "string" + "name": "string", + "schema": { + "person": { + "type": "object", + "props": { + "name": { + "type": "string", + "pattern": "abc", + "required": true + }, + "street": { + "type": "string", + "min": 5, + "max": 10 + }, + "city": { + "type": "string", + "enum": [ + "Berlin" + ] + } + } + }, + "count": { + "type": "number", + "min": 0, + "max": 15, + "required": false + }, + "list": { + "type": "array", + "items": { + "type": "string", + "pattern": "abc", + "required": true + } + } + } }, "_links": { "self": { diff --git a/docs/api-reference/stats/get-all-message-stats.md b/docs/api-reference/stats/get-all-message-stats.md index a7f8c2c..9fe7063 100644 --- a/docs/api-reference/stats/get-all-message-stats.md +++ b/docs/api-reference/stats/get-all-message-stats.md @@ -116,16 +116,50 @@ func main() { ```json { - "message_events": [ - { - "id": "string", - "aggregation_type": "last_1_hour", - "client_id": "d0925250-53db-4747-8b4a-5c4e33d7ff9d", - "stored_at": 0, - "sum": 0, - "type": "message_added" + "aggregated_api_usage_events": { + "last_24_hours": { + "api_key_added": 0, + "api_key_updated": 0, + "api_key_deleted": 0, + "queue_added": 0, + "queue_updated": 0, + "queue_deleted": 0, + "listener_added": 0, + "listener_updated": 0, + "listener_deleted": 0, + "message_added": 0, + "message_published_ok": 0, + "message_published_not_ok": 0 + }, + "last_1_hours": { + "api_key_added": 0, + "api_key_updated": 0, + "api_key_deleted": 0, + "queue_added": 0, + "queue_updated": 0, + "queue_deleted": 0, + "listener_added": 0, + "listener_updated": 0, + "listener_deleted": 0, + "message_added": 0, + "message_published_ok": 0, + "message_published_not_ok": 0 + }, + "today_so_far": { + "api_key_added": 0, + "api_key_updated": 0, + "api_key_deleted": 0, + "queue_added": 0, + "queue_updated": 0, + "queue_deleted": 0, + "listener_added": 0, + "listener_updated": 0, + "listener_deleted": 0, + "message_added": 0, + "message_published_ok": 0, + "message_published_not_ok": 0 } - ], + }, "_links": { "self": { "href": "https://api.discue.io/messages/stats"