From 6495eccf5aab857dbe0709f97a391958e4f1f546 Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Wed, 4 Sep 2024 12:00:22 +0200 Subject: [PATCH 01/11] Add V2 endpoints for datasets, monitors, notifiers, users --- mint.json | 63 ++++-- restapi/endpoints/createDataset.mdx | 2 +- restapi/endpoints/createMonitor.mdx | 4 + restapi/endpoints/createNotifier.mdx | 4 + restapi/endpoints/createUser.mdx | 4 + restapi/endpoints/deleteDataset.mdx | 2 +- restapi/endpoints/deleteMonitor.mdx | 4 + restapi/endpoints/deleteNotifier.mdx | 4 + restapi/endpoints/deleteUser.mdx | 4 + restapi/endpoints/getCurrentUser.mdx | 2 +- restapi/endpoints/getDataset.mdx | 2 +- restapi/endpoints/getDatasets.mdx | 2 +- restapi/endpoints/getMonitor.mdx | 4 + restapi/endpoints/getMonitors.mdx | 4 + restapi/endpoints/getNotifier.mdx | 4 + restapi/endpoints/getNotifiers.mdx | 4 + restapi/endpoints/getUser.mdx | 4 + restapi/endpoints/getUsers.mdx | 4 + restapi/endpoints/trimDataset.mdx | 2 +- restapi/endpoints/updateDataset.mdx | 2 +- restapi/endpoints/updateMonitor.mdx | 4 + restapi/endpoints/updateNotifier.mdx | 4 + restapi/endpoints/updateUser.mdx | 4 + restapi/manage-resources/manage-datasets.mdx | 143 ++++++++++++ restapi/manage-resources/manage-monitors.mdx | 207 ++++++++++++++++++ restapi/manage-resources/manage-notifiers.mdx | 190 ++++++++++++++++ restapi/manage-resources/manage-users.mdx | 156 +++++++++++++ restapi/manage-resources/overview.mdx | 14 ++ 28 files changed, 826 insertions(+), 21 deletions(-) create mode 100644 restapi/endpoints/createMonitor.mdx create mode 100644 restapi/endpoints/createNotifier.mdx create mode 100644 restapi/endpoints/createUser.mdx create mode 100644 restapi/endpoints/deleteMonitor.mdx create mode 100644 restapi/endpoints/deleteNotifier.mdx create mode 100644 restapi/endpoints/deleteUser.mdx create mode 100644 restapi/endpoints/getMonitor.mdx create mode 100644 restapi/endpoints/getMonitors.mdx create mode 100644 restapi/endpoints/getNotifier.mdx create mode 100644 restapi/endpoints/getNotifiers.mdx create mode 100644 restapi/endpoints/getUser.mdx create mode 100644 restapi/endpoints/getUsers.mdx create mode 100644 restapi/endpoints/updateMonitor.mdx create mode 100644 restapi/endpoints/updateNotifier.mdx create mode 100644 restapi/endpoints/updateUser.mdx create mode 100644 restapi/manage-resources/manage-datasets.mdx create mode 100644 restapi/manage-resources/manage-monitors.mdx create mode 100644 restapi/manage-resources/manage-notifiers.mdx create mode 100644 restapi/manage-resources/manage-users.mdx create mode 100644 restapi/manage-resources/overview.mdx diff --git a/mint.json b/mint.json index 38640e5b..cf951be9 100644 --- a/mint.json +++ b/mint.json @@ -324,9 +324,33 @@ ] }, { - "group": "User Endpoints", + "group": "Manage Resources", + "pages": [ + "restapi/manage-resources/overview", + "restapi/manage-resources/manage-datasets", + "restapi/manage-resources/manage-monitors", + "restapi/manage-resources/manage-notifiers", + "restapi/manage-resources/manage-users" + ] + }, + { + "group": "Annotation Endpoints", "pages": [ - "restapi/endpoints/getCurrentUser" + "restapi/endpoints/getAnnotations", + "restapi/endpoints/getAnnotation", + "restapi/endpoints/createAnnotation", + "restapi/endpoints/updateAnnotation", + "restapi/endpoints/deleteAnnotation" + ] + }, + { + "group": "API Token Endpoints", + "pages": [ + "restapi/endpoints/getTokens", + "restapi/endpoints/getToken", + "restapi/endpoints/createToken", + "restapi/endpoints/regenerateToken", + "restapi/endpoints/deleteToken" ] }, { @@ -344,23 +368,34 @@ ] }, { - "group": "Annotation Endpoints", + "group": "Monitor Endpoints", "pages": [ - "restapi/endpoints/getAnnotations", - "restapi/endpoints/getAnnotation", - "restapi/endpoints/createAnnotation", - "restapi/endpoints/updateAnnotation", - "restapi/endpoints/deleteAnnotation" + "restapi/endpoints/getMonitors", + "restapi/endpoints/getMonitor", + "restapi/endpoints/createMonitor", + "restapi/endpoints/updateMonitor", + "restapi/endpoints/deleteMonitor" ] }, { - "group": "API Token Endpoints", + "group": "Notifier Endpoints", "pages": [ - "restapi/endpoints/getTokens", - "restapi/endpoints/getToken", - "restapi/endpoints/createToken", - "restapi/endpoints/regenerateToken", - "restapi/endpoints/deleteToken" + "restapi/endpoints/getNotifiers", + "restapi/endpoints/getNotifier", + "restapi/endpoints/createNotifier", + "restapi/endpoints/updateNotifier", + "restapi/endpoints/deleteNotifier" + ] + }, + { + "group": "User Endpoints", + "pages": [ + "restapi/endpoints/getCurrentUser", + "restapi/endpoints/getUsers", + "restapi/endpoints/getUser", + "restapi/endpoints/createUser", + "restapi/endpoints/updateUser", + "restapi/endpoints/deleteUser" ] } ], diff --git a/restapi/endpoints/createDataset.mdx b/restapi/endpoints/createDataset.mdx index bd04d696..bca0aaca 100644 --- a/restapi/endpoints/createDataset.mdx +++ b/restapi/endpoints/createDataset.mdx @@ -1,4 +1,4 @@ --- title: Create Dataset -openapi: "v1 post /datasets" +openapi: "v2 post /datasets" --- \ No newline at end of file diff --git a/restapi/endpoints/createMonitor.mdx b/restapi/endpoints/createMonitor.mdx new file mode 100644 index 00000000..5f2db20f --- /dev/null +++ b/restapi/endpoints/createMonitor.mdx @@ -0,0 +1,4 @@ +--- +title: Create Monitor +openapi: "v2 post /monitors" +--- \ No newline at end of file diff --git a/restapi/endpoints/createNotifier.mdx b/restapi/endpoints/createNotifier.mdx new file mode 100644 index 00000000..f1fa201a --- /dev/null +++ b/restapi/endpoints/createNotifier.mdx @@ -0,0 +1,4 @@ +--- +title: Create Notifier +openapi: "v2 post /notifiers" +--- \ No newline at end of file diff --git a/restapi/endpoints/createUser.mdx b/restapi/endpoints/createUser.mdx new file mode 100644 index 00000000..0ad12b73 --- /dev/null +++ b/restapi/endpoints/createUser.mdx @@ -0,0 +1,4 @@ +--- +title: Create User +openapi: "v2 post /users" +--- \ No newline at end of file diff --git a/restapi/endpoints/deleteDataset.mdx b/restapi/endpoints/deleteDataset.mdx index cb3f3a07..a2286e7b 100644 --- a/restapi/endpoints/deleteDataset.mdx +++ b/restapi/endpoints/deleteDataset.mdx @@ -1,4 +1,4 @@ --- title: Delete Dataset -openapi: "v1 delete /datasets/{id}" +openapi: "v2 delete /datasets/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/deleteMonitor.mdx b/restapi/endpoints/deleteMonitor.mdx new file mode 100644 index 00000000..3e408e3c --- /dev/null +++ b/restapi/endpoints/deleteMonitor.mdx @@ -0,0 +1,4 @@ +--- +title: Delete Monitor +openapi: "v2 delete /monitors/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/deleteNotifier.mdx b/restapi/endpoints/deleteNotifier.mdx new file mode 100644 index 00000000..a78c6662 --- /dev/null +++ b/restapi/endpoints/deleteNotifier.mdx @@ -0,0 +1,4 @@ +--- +title: Delete Notifier +openapi: "v2 delete /notifiers/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/deleteUser.mdx b/restapi/endpoints/deleteUser.mdx new file mode 100644 index 00000000..f119d59c --- /dev/null +++ b/restapi/endpoints/deleteUser.mdx @@ -0,0 +1,4 @@ +--- +title: Delete User +openapi: "v2 delete /users/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/getCurrentUser.mdx b/restapi/endpoints/getCurrentUser.mdx index e105eb2e..c09386b5 100644 --- a/restapi/endpoints/getCurrentUser.mdx +++ b/restapi/endpoints/getCurrentUser.mdx @@ -1,4 +1,4 @@ --- title: Retrieve Current User -openapi: get /user +openapi: "v2 get /user" --- \ No newline at end of file diff --git a/restapi/endpoints/getDataset.mdx b/restapi/endpoints/getDataset.mdx index 42e76f5f..da039196 100644 --- a/restapi/endpoints/getDataset.mdx +++ b/restapi/endpoints/getDataset.mdx @@ -1,4 +1,4 @@ --- title: Retrieve Dataset -openapi: "v1 get /datasets/{id}" +openapi: "v2 get /datasets/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/getDatasets.mdx b/restapi/endpoints/getDatasets.mdx index 2af6154b..70f25196 100644 --- a/restapi/endpoints/getDatasets.mdx +++ b/restapi/endpoints/getDatasets.mdx @@ -1,4 +1,4 @@ --- title: List All Datasets -openapi: "v1 get /datasets" +openapi: "v2 get /datasets" --- \ No newline at end of file diff --git a/restapi/endpoints/getMonitor.mdx b/restapi/endpoints/getMonitor.mdx new file mode 100644 index 00000000..e91f348b --- /dev/null +++ b/restapi/endpoints/getMonitor.mdx @@ -0,0 +1,4 @@ +--- +title: Retrieve Monitor +openapi: "v2 get /monitors/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/getMonitors.mdx b/restapi/endpoints/getMonitors.mdx new file mode 100644 index 00000000..189aa039 --- /dev/null +++ b/restapi/endpoints/getMonitors.mdx @@ -0,0 +1,4 @@ +--- +title: List All Monitors +openapi: "v2 get /monitors" +--- \ No newline at end of file diff --git a/restapi/endpoints/getNotifier.mdx b/restapi/endpoints/getNotifier.mdx new file mode 100644 index 00000000..387eece3 --- /dev/null +++ b/restapi/endpoints/getNotifier.mdx @@ -0,0 +1,4 @@ +--- +title: Retrieve Notifier +openapi: "v2 get /notifiers/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/getNotifiers.mdx b/restapi/endpoints/getNotifiers.mdx new file mode 100644 index 00000000..1db168a2 --- /dev/null +++ b/restapi/endpoints/getNotifiers.mdx @@ -0,0 +1,4 @@ +--- +title: List All Notifiers +openapi: "v2 get /notifiers" +--- \ No newline at end of file diff --git a/restapi/endpoints/getUser.mdx b/restapi/endpoints/getUser.mdx new file mode 100644 index 00000000..4636881d --- /dev/null +++ b/restapi/endpoints/getUser.mdx @@ -0,0 +1,4 @@ +--- +title: Retrieve User +openapi: "v2 get /users/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/getUsers.mdx b/restapi/endpoints/getUsers.mdx new file mode 100644 index 00000000..e3396bd2 --- /dev/null +++ b/restapi/endpoints/getUsers.mdx @@ -0,0 +1,4 @@ +--- +title: List All Users +openapi: "v2 get /users" +--- \ No newline at end of file diff --git a/restapi/endpoints/trimDataset.mdx b/restapi/endpoints/trimDataset.mdx index 2fa38727..a2b925a3 100644 --- a/restapi/endpoints/trimDataset.mdx +++ b/restapi/endpoints/trimDataset.mdx @@ -1,4 +1,4 @@ --- title: Trim Dataset -openapi: "v1 post /datasets/{id}/trim" +openapi: "v2 post /datasets/{id}/trim" --- \ No newline at end of file diff --git a/restapi/endpoints/updateDataset.mdx b/restapi/endpoints/updateDataset.mdx index b549e6bb..02af2a1a 100644 --- a/restapi/endpoints/updateDataset.mdx +++ b/restapi/endpoints/updateDataset.mdx @@ -1,4 +1,4 @@ --- title: Update Dataset -openapi: "v1 put /datasets/{id}" +openapi: "v2 put /datasets/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/updateMonitor.mdx b/restapi/endpoints/updateMonitor.mdx new file mode 100644 index 00000000..b98c841a --- /dev/null +++ b/restapi/endpoints/updateMonitor.mdx @@ -0,0 +1,4 @@ +--- +title: Update Monitor +openapi: "v2 put /monitors/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/updateNotifier.mdx b/restapi/endpoints/updateNotifier.mdx new file mode 100644 index 00000000..9e612472 --- /dev/null +++ b/restapi/endpoints/updateNotifier.mdx @@ -0,0 +1,4 @@ +--- +title: Update Notifier +openapi: "v2 put /notifiers/{id}" +--- \ No newline at end of file diff --git a/restapi/endpoints/updateUser.mdx b/restapi/endpoints/updateUser.mdx new file mode 100644 index 00000000..e6afe5dc --- /dev/null +++ b/restapi/endpoints/updateUser.mdx @@ -0,0 +1,4 @@ +--- +title: Update User +openapi: "v2 put /users/{id}" +--- \ No newline at end of file diff --git a/restapi/manage-resources/manage-datasets.mdx b/restapi/manage-resources/manage-datasets.mdx new file mode 100644 index 00000000..aaa17d7b --- /dev/null +++ b/restapi/manage-resources/manage-datasets.mdx @@ -0,0 +1,143 @@ +--- +title: Manage datasets via API +sidebarTitle: "Datasets" +description: "Learn how to manage Axiom datasets via API." +tags: ['axiom documentation', 'documentation', 'axiom', 'axiom api', 'rest api', 'rest', 'authorization', 'headers', 'datasets', 'users', 'monitors', 'notifiers', 'response'] +--- + +import Prerequisites from "/snippets/minimal-prerequisites.mdx" + +This page explains how to manage datasets programmatically via the API. + + +{/* list separator */} +- [Create an API token in Axiom](/reference/tokens) with permissions to create, read, update, and delete datasets. +- In the code samples below, replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable. + +## Create datasets + +To create a dataset, send a POST request to the `datasets` endpoint. In the body of the request, specify the name and the description of the dataset. For example: + +```bash +curl -X 'POST' 'https://api.axiom.co/v2/datasets' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "description": "This is a test dataset.", + "name": "test_dataset" + }' +``` + +The example response contains the dataset ID that you can later use to access the dataset programmatically. + +```json +{ + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" +} +``` + +For more information, see the [API reference](/restapi/endpoints/createDataset). + +## Get information about datasets + +### Get information about all datasets + +To get information about all the datasets in your Axiom organization, send a GET request to the `datasets` endpoint. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/datasets' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +The example response is a list of dataset objects. Each object contains a unique dataset ID that you can later use to access the dataset programmatically. + +```json +[ + { + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset1", + "name": "test_dataset1", + "who": "" + }, + { + "created": "2024-04-20T02:35:24.137Z", + "description": "This is another test dataset.", + "id": "test_dataset2", + "name": "test_dataset2", + "who": "" + } +] +``` + +For more information, see the [API reference](/restapi/endpoints/getDatasets). + +### Get information about specific dataset + +To get information about a specific dataset, send a GET request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +Example response: + +```json +[ + { + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" + }, +] +``` + +For more information, see the [API reference](/restapi/endpoints/getDataset). + +## Update datasets + +To update a dataset, send a PUT request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. In the body of the request, specify the properties you want to update. For example: + +```bash +curl -X 'PUT' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "description": "This is a production dataset.", + }' +``` + +Example response: + +```json +{ + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a production dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" +} +``` + +For more information, see the [API reference](/restapi/endpoints/updateDataset). + +## Delete datasets + +To delete a dataset, send a DELETE request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. For example: + +```bash +curl -X 'DELETE' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +For more information, see the [API reference](/restapi/endpoints/deleteDataset). \ No newline at end of file diff --git a/restapi/manage-resources/manage-monitors.mdx b/restapi/manage-resources/manage-monitors.mdx new file mode 100644 index 00000000..c6d39ecb --- /dev/null +++ b/restapi/manage-resources/manage-monitors.mdx @@ -0,0 +1,207 @@ +--- +title: Manage monitors via API +sidebarTitle: "Monitors" +description: "Learn how to manage Axiom monitors via API." +tags: ['axiom documentation', 'documentation', 'axiom', 'axiom api', 'rest api', 'rest', 'authorization', 'headers', 'datasets', 'users', 'monitors', 'notifiers', 'response'] +--- + +import Prerequisites from "/snippets/minimal-prerequisites.mdx" + +This page explains how to manage monitors programmatically via the API. + + +{/* list separator */} +- [Create an API token in Axiom](/reference/tokens) with permissions to create, read, update, and delete monitors. +- In the code samples below, replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable. + +## Create threshold monitors + +To create a threshold monitor, send a POST request to the `monitors` endpoint. In the body of the request, specify the following: +- `name` of your monitor. +- `aplQuery` is the APL query that the monitor periodically runs to aggregate data. Axiom alerts you when the results from your query cross the threshold. +- `threshold` is the value to compare the results of the query to. This can be any numeric value. +- `operator` is the rule to apply when comparing the results to the threshold. The possible values are `Below`, `BelowOrEqual`, `Above`, and `AboveOrEqual`. +- `intervalMinutes` is how often the monitor runs. This is a positive integer number of minutes. +- `rangeMinutes` is the time range for your query. This is a positive integer number of minutes. The end time is the time the monitor runs. +- `alertOnNoData` triggers the monitor when your query doesn’t return any data. Your query returns no data if no events match your filters and an aggregation used in the query is undefined. For example, you take the average of a field not present in any matching events. + +The following fields are optional: +- `description` explains what your monitor does. +- `notifierIds` is a list of notifier IDs. The related notifiers define how you want to receive notifications for this monitor. For more information, see [Manage notifiers](/restapi/manage-resources/manage-notifiers). +- You can group by attributes when defining your query. By default, your monitor enters the alert state if any of the values returned for the group-by attributes cross the threshold, and remains in the alert state until none of the values returned cross the threshold. To trigger the monitor separately for each group that crosses the threshold, set `notifyByGroup` to true. At most one trigger notification is sent per monitor run. This option only has an effect if the monitor’s query groups by a non-time field. + +For example: + +```bash +curl -X 'POST' 'https://api.axiom.co/v2/monitors' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "name": "test_monitor" + "description": "This is a test monitor.", + "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "threshold": 1, + "operator": "Above", + "intervalMinutes": 5, + "rangeMinutes": 5, + "notifierIds": "test_notifier" + "alertOnNoData": false + }' +``` + +The example response contains the monitor ID that you can later use to access the monitor programmatically. + +```json +{ + "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "description": "This is a test monitor.", + "id": "abc123", + "intervalMinutes": 5, + "name": "test_monitor", + "notifierIds": "test_notifier", + "operator": "Above", + "rangeMinutes": 5, + "threshold": 1, + "type": "Threshold" +} +``` + +For more information, see the [API reference](/restapi/endpoints/createMonitor). + +## Get information about monitors + +### Get information about all monitors + +To get information about all the monitors in your Axiom organization, send a GET request to the `monitors` endpoint. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/monitors' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +The example response is a list of monitor objects. Each object contains a unique monitor ID that you can later use to access the monitor programmatically. + +```json +[ + { + "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "description": "This is a test monitor.", + "id": "abc123", + "intervalMinutes": 5, + "name": "test_monitor1", + "notifierIds": "test_notifier", + "operator": "Above", + "rangeMinutes": 5, + "threshold": 1, + "type": "Threshold" + }, + { + "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "description": "This is another test monitor.", + "id": "abc123", + "intervalMinutes": 5, + "name": "test_monitor2", + "notifierIds": "test_notifier", + "operator": "Above", + "rangeMinutes": 5, + "threshold": 1, + "type": "Threshold" + } +] +``` + +For more information, see the [API reference](/restapi/endpoints/getMonitors). + +### Get information about specific monitor + +To get information about a specific monitor, send a GET request to the `monitors/ID` endpoint where `ID` is the unique ID of the monitor. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/monitors/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +Example response: + +```json +{ + "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "description": "This is a test monitor.", + "id": "abc123", + "intervalMinutes": 5, + "name": "test_monitor", + "notifierIds": "test_notifier", + "operator": "Above", + "rangeMinutes": 5, + "threshold": 1, + "type": "Threshold" +} +``` + +For more information, see the [API reference](/restapi/endpoints/getMonitor). + +{/* +### Get information about monitor history + +To get information about the history of a specific monitor, send a GET request to the `monitors/ID/history` endpoint where `ID` is the unique ID of the monitor. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/monitors/abc123/history' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +Example response: + +```json + +``` + +For more information, see the [API reference](/restapi/endpoints/getMonitor). +*/} + +## Update monitors + +To update a monitor, send a PUT request to the `monitors/ID` endpoint where `ID` is the unique ID of the monitor. In the body of the request, specify the properties you want to update. For example: + +```bash +curl -X 'PUT' 'https://api.axiom.co/v2/monitors/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "description": "This is a production monitor." + }' +``` + +Example response: + +```json +{ + "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "description": "This is a production monitor.", + "id": "abc123", + "intervalMinutes": 5, + "name": "test_monitor", + "notifierIds": "test_notifier", + "operator": "Above", + "rangeMinutes": 5, + "threshold": 1, + "type": "Threshold" +} +``` + +For more information, see the [API reference](/restapi/endpoints/updateMonitor). + +## Delete monitors + +To delete a monitor, send a DELETE request to the `monitors/ID` endpoint where `ID` is the unique ID of the monitor. For example: + +```bash +curl -X 'DELETE' 'https://api.axiom.co/v2/monitors/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +For more information, see the [API reference](/restapi/endpoints/deleteMonitor). \ No newline at end of file diff --git a/restapi/manage-resources/manage-notifiers.mdx b/restapi/manage-resources/manage-notifiers.mdx new file mode 100644 index 00000000..4dba194c --- /dev/null +++ b/restapi/manage-resources/manage-notifiers.mdx @@ -0,0 +1,190 @@ +--- +title: Manage notifiers via API +sidebarTitle: "Notifiers" +description: "Learn how to manage Axiom notifiers via API." +tags: ['axiom documentation', 'documentation', 'axiom', 'axiom api', 'rest api', 'rest', 'authorization', 'headers', 'datasets', 'users', 'monitors', 'notifiers', 'response'] +--- + +import Prerequisites from "/snippets/minimal-prerequisites.mdx" + +This page explains how to manage notifiers programmatically via the API. + + +{/* list separator */} +- [Create an API token in Axiom](/reference/tokens) with permissions to create, read, update, and delete datasets. +- In the code samples below, replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable. + +## Create notifiers + +To create a notifier, send a POST request to the `notifiers` endpoint. In the body of the request, specify the following: +- `name` of the notifier. +- The `properties` field takes an object that defines the attributes of the notifier. The required attributes depend on the type of notifier you create. For example, to create an email notifier, specify the list of emails to be notified. + +For example: + +```bash +curl -X 'POST' 'https://api.axiom.co/v2/notifiers' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "name": "test_notifier", + "properties": { + "email": { + "emails": [ + "example1@abc.com", + "example2@abc.com" + ] + } + } + }' +``` + +The example response contains the notifier ID that you can later use to access the notifier programmatically. + +```json +{ + "disabledUntil": "0001-01-01T00:00:00Z", + "id": "abc123", + "name": "test_notifier", + "properties": { + "email": { + "emails": [ + "example1@abc.com", + "example2@abc.com" + ] + } + } +} +``` + +For more information, see the [API reference](/restapi/endpoints/createNotifier). + +## Get information about notifiers + +### Get information about all notifiers + +To get information about all the notifiers in your Axiom organization, send a GET request to the `notifiers` endpoint. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/notifiers' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +The example response is a list of notifier objects. Each object contains a unique notifier ID that you can later use to access the notifier programmatically. + +```json +[ + { + "disabledUntil": "0001-01-01T00:00:00Z", + "id": "abc123", + "name": "test_notifier1", + "properties": { + "email": { + "emails": [ + "example1@abc.com", + "example2@abc.com" + ] + } + } + }, + { + "disabledUntil": "0001-01-01T00:00:00Z", + "id": "abc321", + "name": "test_notifier2", + "properties": { + "email": { + "emails": [ + "example3@abc.com", + "example4@abc.com" + ] + } + } + } +] +``` + +For more information, see the [API reference](/restapi/endpoints/getNotifiers). + +### Get information about specific notifier + +To get information about a specific notifier, send a GET request to the `notifiers/ID` endpoint where `ID` is the unique ID of the notifier. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/notifiers/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +Example response: + +```json +{ + "disabledUntil": "0001-01-01T00:00:00Z", + "id": "abc123", + "name": "test_notifier", + "properties": { + "email": { + "emails": [ + "example1@abc.com", + "example2@abc.com" + ] + } + } +} +``` + +For more information, see the [API reference](/restapi/endpoints/getNotifier). + +## Update notifiers + +To update a notifier, send a PUT request to the `notifiers/ID` endpoint where `ID` is the unique ID of the notifier. In the body of the request, specify the properties you want to update. Include the `name` field even if you don’t want to change it. For example: + +```bash +curl -X 'PUT' 'https://api.axiom.co/v2/notifiers/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "name": "test_notifier", + "properties": { + "email": { + "emails": [ + "example3@abc.com", + "example4@abc.com" + ] + } + } + }' +``` + +Example response: + +```json +{ + "disabledUntil": "0001-01-01T00:00:00Z", + "id": "abc123", + "name": "test_notifier", + "properties": { + "email": { + "emails": [ + "example3@abc.com", + "example4@abc.com" + ] + } + } +} +``` + +For more information, see the [API reference](/restapi/endpoints/updateNotifier). + +## Delete notifiers + +To delete a notifier, send a DELETE request to the `notifiers/ID` endpoint where `ID` is the unique ID of the notifier. For example: + +```bash +curl -X 'DELETE' 'https://api.axiom.co/v2/notifiers/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +For more information, see the [API reference](/restapi/endpoints/deleteNotifier). \ No newline at end of file diff --git a/restapi/manage-resources/manage-users.mdx b/restapi/manage-resources/manage-users.mdx new file mode 100644 index 00000000..0078b4ab --- /dev/null +++ b/restapi/manage-resources/manage-users.mdx @@ -0,0 +1,156 @@ +--- +title: Manage users via API +sidebarTitle: "Users" +description: "Learn how to manage Axiom users via API." +tags: ['axiom documentation', 'documentation', 'axiom', 'axiom api', 'rest api', 'rest', 'authorization', 'headers', 'datasets', 'users', 'monitors', 'notifiers', 'response'] +--- + +import Prerequisites from "/snippets/minimal-prerequisites.mdx" + +This page explains how to manage users programmatically via the API. + + +{/* list separator */} +- [Create an API token in Axiom](/reference/tokens) with permissions to create, read, update, and delete datasets. +- In the code samples below, replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable. + +## Create users + +To create a user, send a POST request to the `users` endpoint. In the body of the request, specify the following: +- `name` + +For example: + +```bash +curl -X 'POST' 'https://api.axiom.co/v2/users' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "name": "test_user", + "email": "example@abc.com", + "role": "admin" + }' +``` + +The example response contains the user ID that you can later use to access the user programmatically. + +```json +{ + "email": "example@abc.com", + "id": "abc123", + "name": "test_user", + "role": { + "id": "admin", + "name": "admin" + } +} +``` + +For more information, see the [API reference](/restapi/endpoints/createUser). + +## Get information about users + +### Get information about all users + +To get information about all the users in your Axiom organization, send a GET request to the `users` endpoint. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/users' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +The example response is a list of user objects. Each object contains a unique user ID that you can later use to access the user programmatically. + +```json +[ + { + "email": "example1@abc.com", + "id": "abc123", + "name": "test_user1", + "role": { + "id": "admin", + "name": "admin" + } + }, + { + "email": "example2@abc.com", + "id": "abc321", + "name": "test_user2", + "role": { + "id": "admin", + "name": "admin" + } + } +] +``` + +For more information, see the [API reference](/restapi/endpoints/getUsers). + +### Get information about specific user + +To get information about a specific user, send a GET request to the `users/ID` endpoint where `ID` is the unique ID of the user. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/users/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +Example response: + +```json +{ + "email": "example@abc.com", + "id": "abc123", + "name": "test_user", + "role": { + "id": "admin", + "name": "admin" + } +} +``` + +For more information, see the [API reference](/restapi/endpoints/getUser). + +## Update users + +To update a user, send a PUT request to the `users/ID` endpoint where `ID` is the unique ID of the user. In the body of the request, specify the properties you want to update. Include the `name` field even if you don’t want to change it. For example: + +```bash +curl -X 'PUT' 'https://api.axiom.co/v2/users/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "name": "test_user", + "email": "example2@abc.com", + }' +``` + +Example response: + +```json +{ + "email": "example2@abc.com", + "id": "abc123", + "name": "test_user", + "role": { + "id": "admin", + "name": "admin" + } +} +``` + +For more information, see the [API reference](/restapi/endpoints/updateUser). + +## Delete users + +To delete a user, send a DELETE request to the `users/ID` endpoint where `ID` is the unique ID of the user. For example: + +```bash +curl -X 'DELETE' 'https://api.axiom.co/v2/users/abc123' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +For more information, see the [API reference](/restapi/endpoints/deleteUser). \ No newline at end of file diff --git a/restapi/manage-resources/overview.mdx b/restapi/manage-resources/overview.mdx new file mode 100644 index 00000000..d74f100a --- /dev/null +++ b/restapi/manage-resources/overview.mdx @@ -0,0 +1,14 @@ +--- +title: "Manage Axiom resources via API" +description: "Learn how to manage Axiom resources via API." +sidebarTitle: Overview +tags: ['axiom documentation', 'documentation', 'axiom', 'axiom api', 'rest api', 'rest', 'authorization', 'headers', 'datasets', 'users', 'monitors', 'notifiers', 'response'] +--- + +This section explains how to manage Axiom resources programmatically via the API. + +You can create, read, update, and delete the following resources using the API: +- [Datasets](/restapi/manage-resources/manage-datasets) +- [Monitors](/restapi/manage-resources/manage-monitors) +- [Notifiers](/restapi/manage-resources/manage-notifiers) +- [Users](/restapi/manage-resources/manage-users) \ No newline at end of file From 6f4bb4dda3d8a49c8f983e82830eebf3e1f5b9c6 Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Wed, 4 Sep 2024 12:25:20 +0200 Subject: [PATCH 02/11] Update V2 swagger file from axiom repo --- restapi/manage-resources/manage-datasets.mdx | 2 +- restapi/versions/v2.json | 493 ++++++++++++++++++- 2 files changed, 491 insertions(+), 4 deletions(-) diff --git a/restapi/manage-resources/manage-datasets.mdx b/restapi/manage-resources/manage-datasets.mdx index aaa17d7b..35a02b23 100644 --- a/restapi/manage-resources/manage-datasets.mdx +++ b/restapi/manage-resources/manage-datasets.mdx @@ -112,7 +112,7 @@ curl -X 'PUT' 'https://api.axiom.co/v2/datasets/test_dataset' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer API_TOKEN' \ -d '{ - "description": "This is a production dataset.", + "description": "This is a production dataset." }' ``` diff --git a/restapi/versions/v2.json b/restapi/versions/v2.json index 376579ac..f71d37ed 100644 --- a/restapi/versions/v2.json +++ b/restapi/versions/v2.json @@ -411,6 +411,77 @@ "x-codegen-request-body-name": "payload" } }, + "/datasets/_apl/delete": { + "post": { + "tags": [ + "query" + ], + "description": "Delete blocks that have non-zero matches for an APL query.", + "operationId": "datasetAPLDeletionQuery", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AplDeletionRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "AplDeletionResponse", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AplDeletionResponse" + } + } + } + }, + "400": { + "description": "AplQueryError", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AplQueryError" + } + } + } + }, + "404": { + "description": "AplQueryError", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AplQueryError" + } + } + } + }, + "500": { + "description": "AplQueryError", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AplQueryError" + } + } + } + } + }, + "security": [ + { + "Auth": [ + "datasets|update" + ] + } + ], + "x-axiom-nocompress": true, + "x-axiom-not-suspended": true, + "x-codegen-request-body-name": "payload" + } + }, "/datasets/{id}": { "get": { "tags": [ @@ -1242,6 +1313,245 @@ "x-codegen-request-body-name": "payload" } }, + "/slack/auth": { + "get": { + "tags": [ + "Slack" + ], + "description": "Authenticate the user", + "operationId": "handleSlackAuth", + "parameters": [ + { + "name": "state", + "in": "query", + "description": "Slack state to authenticate", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Authentication successful", + "content": {} + }, + "400": { + "description": "Unsuccessful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + } + } + } + } + }, + "security": [ + { + "Auth": [] + } + ], + "x-axiom-preview": true + } + }, + "/slack/auth/callback": { + "get": { + "tags": [ + "Slack" + ], + "description": "Handle OAuth callback from Slack", + "operationId": "handleOAuthCallback", + "parameters": [ + { + "name": "code", + "in": "query", + "description": "OAuth authorization code from Slack", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "state", + "in": "query", + "description": "OAuth state parameter for CSRF protection", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Authentication successful", + "content": {} + }, + "303": { + "description": "Redirect to login", + "headers": { + "Location": { + "schema": { + "type": "string" + } + } + }, + "content": {} + }, + "400": { + "description": "Invalid request or authentication failed", + "content": {} + } + }, + "security": [], + "x-axiom-preview": true + } + }, + "/slack/axiomLogin/callback": { + "get": { + "tags": [ + "Slack" + ], + "description": "Authenticate the user against Axiom", + "operationId": "handleAxiomLogin", + "parameters": [ + { + "name": "state", + "in": "query", + "description": "Slack state to authenticate", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "code", + "in": "query", + "description": "Login server code", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": {} + }, + "400": { + "description": "Unsuccessful response", + "content": {} + } + }, + "security": [], + "x-axiom-preview": true + } + }, + "/slack/events": { + "post": { + "tags": [ + "Slack" + ], + "description": "Post Slack events", + "operationId": "postSlackEvent", + "parameters": [ + { + "name": "X-Slack-Signature", + "in": "header", + "description": "Slack request signature for verifying the request.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Slack-Request-Timestamp", + "in": "header", + "description": "Slack request timestamp for verifying the request.", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SlackEvent" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Event received", + "content": {} + }, + "400": { + "description": "Invalid event data", + "content": {} + } + }, + "security": [], + "x-axiom-preview": true, + "x-codegen-request-body-name": "event" + } + }, + "/slack/handleSlashCommand": { + "post": { + "tags": [ + "Slack" + ], + "description": "Redirect user to Slack for authentication", + "operationId": "handleSlashCommand", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "response_type": { + "type": "string" + }, + "text": { + "type": "string" + } + } + } + } + } + } + }, + "security": [], + "x-axiom-preview": true + } + }, + "/slack/interactiveEndpoint": { + "post": { + "tags": [ + "Slack" + ], + "description": "Post Slack interactive endpoint", + "operationId": "postSlackInteractiveEndpoint", + "responses": { + "200": { + "description": "Event received", + "content": {} + } + }, + "security": [], + "x-axiom-preview": true + } + }, "/tokens": { "get": { "tags": [ @@ -1881,6 +2191,73 @@ "type": "AnnotationID" } }, + "AplDeletionRequest": { + "required": [ + "apl", + "commit" + ], + "type": "object", + "properties": { + "Modules": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Modules is an optional set of module names => module sources that will be available to this query" + }, + "apl": { + "type": "string" + }, + "commit": { + "type": "boolean" + }, + "endTime": { + "type": "string" + }, + "startTime": { + "type": "string", + "description": "start and end time for the query, these must be specified as RFC3339 strings\nor using relative time expressions (e.g. now-1h, now-1d, now-1w, etc)" + }, + "variables": { + "type": "object", + "additionalProperties": { + "type": "object" + }, + "description": "Variables is an optional set of additional variables that are inserted into the APL" + } + } + }, + "AplDeletionResponse": { + "required": [ + "rowsDeleted", + "rowsMatched" + ], + "type": "object", + "properties": { + "blocksMatched": { + "type": "integer", + "format": "uint64" + }, + "dryRun": { + "type": "boolean" + }, + "firstMatchedEvent": { + "type": "string", + "description": "these are timestamps" + }, + "lastMatchedEvent": { + "type": "string" + }, + "rowsDeleted": { + "type": "integer", + "format": "uint64" + }, + "rowsMatched": { + "type": "integer", + "format": "uint64" + } + } + }, "AplQueryError": { "type": "object", "properties": { @@ -2246,6 +2623,18 @@ "columnName": { "type": "string" }, + "compareDays": { + "maximum": 7, + "type": "number", + "format": "int64" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "createdBy": { + "type": "string" + }, "description": { "type": "string" }, @@ -2283,7 +2672,8 @@ "Below", "BelowOrEqual", "Above", - "AboveOrEqual" + "AboveOrEqual", + "AboveOrBelow" ] }, "rangeMinutes": { @@ -2294,16 +2684,34 @@ "resolvable": { "type": "boolean" }, + "secondDelay": { + "maximum": 86400, + "type": "number", + "format": "int64" + }, "threshold": { "type": "number", - "format": "double" + "format": "double", + "x-omitempty": false + }, + "tolerance": { + "maximum": 100, + "type": "number" + }, + "triggerAfterNPositiveResults": { + "type": "number", + "format": "int64" + }, + "triggerFromNRuns": { + "type": "number", + "format": "int64" }, "type": { "type": "string", "enum": [ "Threshold", "MatchEvent", - "FieldAnomalyDetection" + "AnomalyDetection" ] } } @@ -2362,6 +2770,15 @@ ], "type": "object", "properties": { + "createdAt": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "createdBy": { + "type": "string", + "readOnly": true + }, "disabledUntil": { "type": "string" }, @@ -2492,6 +2909,76 @@ } } }, + "SlackEvent": { + "required": [ + "api_app_id", + "event", + "event_id", + "event_time", + "team_id", + "token", + "type" + ], + "type": "object", + "properties": { + "api_app_id": { + "type": "string", + "description": "ID of the Slack app that the event is for" + }, + "event": { + "required": [ + "channel", + "ts", + "type", + "user" + ], + "type": "object", + "properties": { + "channel": { + "type": "string", + "description": "Channel ID where the event occurred" + }, + "text": { + "type": "string", + "description": "Text content of the event" + }, + "ts": { + "type": "string", + "description": "Timestamp of when the event occurred" + }, + "type": { + "type": "string", + "description": "Type of the event" + }, + "user": { + "type": "string", + "description": "ID of the user who triggered the event" + } + } + }, + "event_id": { + "type": "string", + "description": "Unique identifier for the event" + }, + "event_time": { + "type": "integer", + "description": "Timestamp of when the event was dispatched", + "format": "int64" + }, + "team_id": { + "type": "string", + "description": "ID of the team where the event originated" + }, + "token": { + "type": "string", + "description": "Verification token to validate the event is from Slack" + }, + "type": { + "type": "string", + "description": "Type of the event callback" + } + } + }, "SourceInfo": { "title": "SourceInfo specifies the provenance of a results Table.", "type": "object", From 872527515551f9a7d1baa78f47649456ba58cf5f Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Wed, 4 Sep 2024 16:21:06 +0200 Subject: [PATCH 03/11] Fix examples --- restapi/manage-resources/manage-monitors.mdx | 27 +++++++++++++------ restapi/manage-resources/manage-notifiers.mdx | 4 +++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/restapi/manage-resources/manage-monitors.mdx b/restapi/manage-resources/manage-monitors.mdx index c6d39ecb..082d3df0 100644 --- a/restapi/manage-resources/manage-monitors.mdx +++ b/restapi/manage-resources/manage-monitors.mdx @@ -37,14 +37,14 @@ curl -X 'POST' 'https://api.axiom.co/v2/monitors' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer API_TOKEN' \ -d '{ - "name": "test_monitor" + "name": "test_monitor", "description": "This is a test monitor.", "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", "threshold": 1, "operator": "Above", "intervalMinutes": 5, "rangeMinutes": 5, - "notifierIds": "test_notifier" + "notifierIds": ["test_notifier"], "alertOnNoData": false }' ``` @@ -54,14 +54,16 @@ The example response contains the monitor ID that you can later use to access th ```json { "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "createdAt": "2024-09-04T13:56:22.222Z", "description": "This is a test monitor.", "id": "abc123", "intervalMinutes": 5, "name": "test_monitor", - "notifierIds": "test_notifier", + "notifierIds": ["test_notifier"], "operator": "Above", "rangeMinutes": 5, "threshold": 1, + "triggerFromNRuns": 1, "type": "Threshold" } ``` @@ -86,26 +88,30 @@ The example response is a list of monitor objects. Each object contains a unique [ { "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "createdAt": "2024-09-04T13:56:22.222Z", "description": "This is a test monitor.", "id": "abc123", "intervalMinutes": 5, "name": "test_monitor1", - "notifierIds": "test_notifier", + "notifierIds": ["test_notifier"], "operator": "Above", "rangeMinutes": 5, "threshold": 1, + "triggerFromNRuns": 1, "type": "Threshold" }, { "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "createdAt": "2024-09-04T13:56:22.222Z", "description": "This is another test monitor.", - "id": "abc123", + "id": "abc321", "intervalMinutes": 5, "name": "test_monitor2", - "notifierIds": "test_notifier", + "notifierIds": ["test_notifier"], "operator": "Above", "rangeMinutes": 5, "threshold": 1, + "triggerFromNRuns": 1, "type": "Threshold" } ] @@ -128,14 +134,16 @@ Example response: ```json { "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "createdAt": "2024-09-04T13:56:22.222Z", "description": "This is a test monitor.", "id": "abc123", "intervalMinutes": 5, "name": "test_monitor", - "notifierIds": "test_notifier", + "notifierIds": ["test_notifier"], "operator": "Above", "rangeMinutes": 5, "threshold": 1, + "triggerFromNRuns": 1, "type": "Threshold" } ``` @@ -171,6 +179,7 @@ curl -X 'PUT' 'https://api.axiom.co/v2/monitors/abc123' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer API_TOKEN' \ -d '{ + "name": "test_monitor", "description": "This is a production monitor." }' ``` @@ -180,14 +189,16 @@ Example response: ```json { "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "createdAt": "2024-09-04T13:56:22.222Z", "description": "This is a production monitor.", "id": "abc123", "intervalMinutes": 5, "name": "test_monitor", - "notifierIds": "test_notifier", + "notifierIds": ["test_notifier"], "operator": "Above", "rangeMinutes": 5, "threshold": 1, + "triggerFromNRuns": 1, "type": "Threshold" } ``` diff --git a/restapi/manage-resources/manage-notifiers.mdx b/restapi/manage-resources/manage-notifiers.mdx index 4dba194c..c617fcb5 100644 --- a/restapi/manage-resources/manage-notifiers.mdx +++ b/restapi/manage-resources/manage-notifiers.mdx @@ -43,6 +43,7 @@ The example response contains the notifier ID that you can later use to access t ```json { + "createdAt":"2024-09-04T11:42:50.225Z", "disabledUntil": "0001-01-01T00:00:00Z", "id": "abc123", "name": "test_notifier", @@ -76,6 +77,7 @@ The example response is a list of notifier objects. Each object contains a uniqu ```json [ { + "createdAt":"2024-09-04T11:42:50.225Z", "disabledUntil": "0001-01-01T00:00:00Z", "id": "abc123", "name": "test_notifier1", @@ -89,6 +91,7 @@ The example response is a list of notifier objects. Each object contains a uniqu } }, { + "createdAt":"2024-09-04T11:42:50.225Z", "disabledUntil": "0001-01-01T00:00:00Z", "id": "abc321", "name": "test_notifier2", @@ -120,6 +123,7 @@ Example response: ```json { + "createdAt":"2024-09-04T11:42:50.225Z", "disabledUntil": "0001-01-01T00:00:00Z", "id": "abc123", "name": "test_notifier", From 1181efe8e2b8f97c688439e4c2602fff737f6fdd Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Wed, 4 Sep 2024 16:29:12 +0200 Subject: [PATCH 04/11] Fix update monitor --- restapi/manage-resources/manage-monitors.mdx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/restapi/manage-resources/manage-monitors.mdx b/restapi/manage-resources/manage-monitors.mdx index 082d3df0..c3d82d4f 100644 --- a/restapi/manage-resources/manage-monitors.mdx +++ b/restapi/manage-resources/manage-monitors.mdx @@ -180,7 +180,14 @@ curl -X 'PUT' 'https://api.axiom.co/v2/monitors/abc123' \ -H 'Authorization: Bearer API_TOKEN' \ -d '{ "name": "test_monitor", - "description": "This is a production monitor." + "description": "This is a production monitor.", + "aplQuery": "test_dataset | summarize count() by bin_auto(_time)", + "threshold": 1, + "operator": "Above", + "intervalMinutes": 5, + "rangeMinutes": 5, + "notifierIds": ["test_notifier"], + "alertOnNoData": false }' ``` From f447e0a934b2c9b8165fe02bc431b61104f3b03e Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Wed, 30 Oct 2024 12:38:42 +0100 Subject: [PATCH 05/11] Update mint.json --- mint.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mint.json b/mint.json index b3356286..29535f8e 100644 --- a/mint.json +++ b/mint.json @@ -455,7 +455,7 @@ ] }, { - "group": "Manage Resources", + "group": "Manage resources", "pages": [ "restapi/manage-resources/overview", "restapi/manage-resources/manage-datasets", @@ -485,7 +485,7 @@ ] }, { - "group": "Dataset Endpoints", + "group": "Dataset endpoints", "pages": [ "restapi/endpoints/getDatasets", "restapi/endpoints/getDataset", @@ -499,7 +499,7 @@ ] }, { - "group": "Monitor Endpoints", + "group": "Monitor endpoints", "pages": [ "restapi/endpoints/getMonitors", "restapi/endpoints/getMonitor", @@ -509,7 +509,7 @@ ] }, { - "group": "Notifier Endpoints", + "group": "Notifier endpoints", "pages": [ "restapi/endpoints/getNotifiers", "restapi/endpoints/getNotifier", @@ -519,7 +519,7 @@ ] }, { - "group": "User Endpoints", + "group": "User endpoints", "pages": [ "restapi/endpoints/getCurrentUser", "restapi/endpoints/getUsers", From 1ba0f8762347cff0bdb82b0807181c5e9190f97a Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Tue, 11 Feb 2025 16:12:38 +0100 Subject: [PATCH 06/11] Add latest v2 swagger file --- restapi/versions/v2.json | 1549 +++++++++++++++++++++++++++++++++++++- 1 file changed, 1515 insertions(+), 34 deletions(-) diff --git a/restapi/versions/v2.json b/restapi/versions/v2.json index ecba7e58..e26aa243 100644 --- a/restapi/versions/v2.json +++ b/restapi/versions/v2.json @@ -399,6 +399,884 @@ }, "x-axiom-not-suspended": true } + }, + "/datasets": { + "get": { + "description": "Get list of datasets", + "tags": [ + "Datasets" + ], + "summary": "Get list of datasets", + "operationId": "getDatasets", + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Dataset" + }, + "example": [ + { + "created": "2020-01-01T00:00:00Z", + "description": "This is an example dataset", + "id": "example-dataset", + "name": "example-dataset", + "who": "John Doe" + }, + { + "created": "2020-02-01T00:00:00Z", + "description": "This is an example dataset", + "id": "example-dataset-2", + "name": "example-dataset-2", + "who": "Foo Bar" + } + ] + } + } + } + }, + "401": { + "$ref": "#/components/responses/ForbiddenError" + } + }, + "x-axiom-preview": true + }, + "post": { + "security": [ + { + "Auth": [ + "datasets|create" + ] + } + ], + "description": "Create dataset", + "tags": [ + "Datasets" + ], + "summary": "Create dataset", + "operationId": "createDataset", + "parameters": [ + { + "description": "Referrer slug", + "name": "referrer", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateDataset" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Dataset" + } + } + } + }, + "401": { + "$ref": "#/components/responses/ForbiddenError" + } + }, + "x-axiom-preview": true + } + }, + "/datasets/{id}": { + "get": { + "security": [ + { + "Auth": [ + "datasets|delete" + ] + } + ], + "description": "Get dataset by ID", + "tags": [ + "Datasets" + ], + "summary": "Get dataset by ID", + "operationId": "getDataset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Dataset" + } + } + } + }, + "401": { + "$ref": "#/components/responses/ForbiddenError" + }, + "404": { + "$ref": "#/components/responses/NotFoundError" + } + }, + "x-axiom-preview": true + }, + "put": { + "security": [ + { + "Auth": [ + "datasets|update" + ] + } + ], + "description": "Update dataset", + "tags": [ + "Datasets" + ], + "summary": "Update dataset", + "operationId": "updateDataset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateDataset" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Dataset", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Dataset" + } + } + } + }, + "401": { + "$ref": "#/components/responses/ForbiddenError" + } + }, + "x-axiom-preview": true + }, + "delete": { + "security": [ + { + "Auth": [ + "datasets|delete" + ] + } + ], + "description": "Delete dataset", + "tags": [ + "Datasets" + ], + "summary": "Delete dataset", + "operationId": "deleteDataset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "(empty)" + }, + "401": { + "$ref": "#/components/responses/ForbiddenError" + } + }, + "x-axiom-preview": true + } + }, + "/datasets/{id}/trim": { + "post": { + "security": [ + { + "Auth": [ + "trim|update" + ] + } + ], + "description": "Trim dataset", + "tags": [ + "Datasets" + ], + "summary": "Trim dataset by duration", + "operationId": "trimDataset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TrimOptions" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "TrimResult" + }, + "401": { + "$ref": "#/components/responses/ForbiddenError" + }, + "404": { + "$ref": "#/components/responses/NotFoundError" + } + }, + "x-axiom-preview": true + } + }, + "/monitors": { + "get": { + "security": [ + { + "Auth": [ + "monitors|read" + ] + } + ], + "description": "Get monitors", + "tags": [ + "Monitors" + ], + "operationId": "getMonitors", + "responses": { + "200": { + "description": "Monitor", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Monitor" + } + } + } + } + } + }, + "x-axiom-preview": true + }, + "post": { + "security": [ + { + "Auth": [ + "monitors|create" + ] + } + ], + "description": "Create monitor", + "tags": [ + "Monitors" + ], + "operationId": "createMonitor", + "requestBody": { + "$ref": "#/components/requestBodies/Monitor" + }, + "responses": { + "200": { + "description": "Monitor", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Monitor" + } + } + } + } + }, + "x-axiom-preview": true + } + }, + "/monitors/{id}": { + "get": { + "security": [ + { + "Auth": [ + "monitors|read" + ] + } + ], + "description": "Get monitor by ID", + "tags": [ + "Monitors" + ], + "operationId": "getMonitor", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Monitor", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Monitor" + } + } + } + } + }, + "x-axiom-preview": true + }, + "put": { + "security": [ + { + "Auth": [ + "monitors|update" + ] + } + ], + "description": "Update monitor", + "tags": [ + "Monitors" + ], + "operationId": "updateMonitor", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/Monitor" + }, + "responses": { + "200": { + "description": "Monitor", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Monitor" + } + } + } + } + }, + "x-axiom-preview": true + }, + "delete": { + "security": [ + { + "Auth": [ + "monitors|delete" + ] + } + ], + "description": "Delete monitor", + "tags": [ + "Monitors" + ], + "operationId": "deleteMonitor", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "Success" + } + }, + "x-axiom-preview": true + } + }, + "/notifiers": { + "get": { + "security": [ + { + "Auth": [ + "notifiers|read" + ] + } + ], + "description": "Get notifiers", + "tags": [ + "Monitors" + ], + "operationId": "getNotifiers", + "responses": { + "200": { + "description": "Notifier", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Notifier" + } + } + } + } + } + }, + "x-axiom-preview": true + }, + "post": { + "security": [ + { + "Auth": [ + "notifiers|create" + ] + } + ], + "description": "Create notifier", + "tags": [ + "Monitors" + ], + "operationId": "createNotifier", + "requestBody": { + "$ref": "#/components/requestBodies/Notifier" + }, + "responses": { + "200": { + "description": "Notifier", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notifier" + } + } + } + } + }, + "x-axiom-preview": true + } + }, + "/notifiers/{id}": { + "get": { + "security": [ + { + "Auth": [ + "notifiers|read" + ] + } + ], + "description": "Get notifier by ID", + "tags": [ + "Monitors" + ], + "operationId": "getNotifier", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Notifier", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notifier" + } + } + } + } + }, + "x-axiom-preview": true + }, + "put": { + "security": [ + { + "Auth": [ + "notifiers|update" + ] + } + ], + "description": "Update notifier", + "tags": [ + "Monitors" + ], + "operationId": "updateNotifier", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/Notifier" + }, + "responses": { + "200": { + "description": "Notifier", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notifier" + } + } + } + } + }, + "x-axiom-preview": true + }, + "delete": { + "security": [ + { + "Auth": [ + "notifiers|delete" + ] + } + ], + "description": "Delete notifier", + "tags": [ + "Monitors" + ], + "operationId": "deleteNotifier", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "(empty)" + } + }, + "x-axiom-preview": true + } + }, + "/user": { + "get": { + "description": "Get current user", + "tags": [ + "Users" + ], + "operationId": "getCurrentUser", + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-no-org-required": true, + "x-axiom-preview": true + } + }, + "/users": { + "get": { + "security": [ + { + "Auth": [ + "users|read" + ] + } + ], + "description": "Get users", + "tags": [ + "Users" + ], + "operationId": "getUsers", + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + } + } + } + } + }, + "x-axiom-preview": true + }, + "post": { + "security": [ + { + "Auth": [ + "users|create" + ] + } + ], + "description": "Create user", + "tags": [ + "Users" + ], + "operationId": "createUser", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-no-org-required": true, + "x-axiom-not-suspended": true, + "x-axiom-preview": true + } + }, + "/users/{id}": { + "get": { + "security": [ + { + "Auth": [ + "users|read" + ] + } + ], + "description": "Get user by ID", + "tags": [ + "Users" + ], + "operationId": "getUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-preview": true + }, + "put": { + "security": [ + { + "Auth": [ + "users|update" + ] + } + ], + "description": "Update user", + "tags": [ + "Users" + ], + "operationId": "updateUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserUpdate" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-no-org-required": true, + "x-axiom-preview": true + }, + "delete": { + "security": [ + { + "Auth": [ + "users|delete" + ] + } + ], + "description": "Delete user", + "tags": [ + "Users" + ], + "operationId": "deleteUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "(empty)" + } + }, + "x-axiom-preview": true + } + }, + "/users/{id}/role": { + "put": { + "security": [ + { + "Auth": [ + "users|update" + ] + } + ], + "description": "Update user role", + "tags": [ + "Users" + ], + "operationId": "updateUserRole", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserRole" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-preview": true + } } }, "components": { @@ -482,6 +1360,26 @@ } }, "requestBodies": { + "Repo": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Repo" + } + } + }, + "required": true + }, + "PostOrg": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostOrg" + } + } + }, + "required": true + }, "Monitor": { "content": { "application/json": { @@ -501,6 +1399,16 @@ } }, "required": true + }, + "VirtualField": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VirtualField" + } + } + }, + "required": true } }, "securitySchemes": { @@ -554,6 +1462,12 @@ }, "orgCapabilities": { "$ref": "#/components/schemas/orgCapabilities" + }, + "samlAuthenticated": { + "type": "boolean" + }, + "viewCapabilities": { + "$ref": "#/components/schemas/viewCapabilities" } } }, @@ -695,7 +1609,7 @@ ], "properties": { "Modules": { - "description": "Modules is an optional set of module names => module sources that will be available to this query", + "description": "Key-value pairs of module names and module sources. Axiom will make modules available for this query later.", "type": "object", "additionalProperties": { "type": "string" @@ -752,6 +1666,42 @@ } } }, + "AplModuleDefinition": { + "type": "object", + "properties": { + "constant": { + "$ref": "#/components/schemas/Constant" + }, + "description": { + "description": "The description of the apl module definition.", + "type": "string" + }, + "id": { + "description": "The unique identifier for the object.", + "type": "string" + }, + "lookup": { + "$ref": "#/components/schemas/Lookup" + }, + "name": { + "description": "The name of the apl module definition.", + "type": "string" + }, + "namespace": { + "description": "The namespace of the APL module definition.", + "type": "string" + }, + "type": { + "description": "The type of the object.", + "type": "string", + "enum": [ + "REGEX", + "CONSTANT", + "LOOKUP" + ] + } + } + }, "AplQueryError": { "type": "object", "properties": { @@ -860,6 +1810,14 @@ } } }, + "Constant": { + "type": "object", + "properties": { + "value": { + "description": "Constant value of any type" + } + } + }, "CreateAPIToken": { "type": "object", "required": [ @@ -885,6 +1843,9 @@ }, "orgCapabilities": { "$ref": "#/components/schemas/orgCapabilities" + }, + "viewCapabilities": { + "$ref": "#/components/schemas/viewCapabilities" } } }, @@ -961,6 +1922,12 @@ "type": "string" } }, + "secretHeaders": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "url": { "type": "string" } @@ -993,6 +1960,10 @@ "description": "Unique dataset name", "type": "string" }, + "sharedByOrg": { + "description": "ID of the org that shared this resource, if it's shared", + "type": "string" + }, "who": { "description": "Name of the dataset creator", "type": "string" @@ -1011,49 +1982,243 @@ "discordChannel": { "type": "string" }, - "discordToken": { - "type": "string" - } - } - }, - "DiscordWebhookConfig": { - "properties": { - "discordWebhookUrl": { - "type": "string" - } - } - }, - "EmailConfig": { - "properties": { - "emails": { + "discordToken": { + "type": "string" + } + } + }, + "DiscordWebhookConfig": { + "properties": { + "discordWebhookUrl": { + "type": "string" + } + } + }, + "EmailConfig": { + "properties": { + "emails": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "ExternalPlan": { + "type": "object", + "required": [ + "state" + ], + "properties": { + "endingBefore": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "nextBillingDate": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "planID": { + "type": "string" + }, + "planInstanceID": { + "type": "string" + }, + "startingOn": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "state": { + "type": "string", + "enum": [ + "active", + "inTrial", + "incubation", + "sunset", + "migration", + "empty" + ] + }, + "trialEndingBefore": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "trialed": { + "type": "boolean" + } + } + }, + "FieldInfo": { + "type": "object", + "title": "FieldInfo captures information about a field used in the tabular result format. See Table.", + "properties": { + "agg": { + "$ref": "#/components/schemas/AggInfo" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, + "GroupInfo": { + "type": "object", + "title": "GroupInfo captures information about a grouping clause in the tabular result format. See Table.", + "properties": { + "name": { + "type": "string" + } + } + }, + "License": { + "type": "object", + "required": [ + "id", + "tier", + "issuer", + "issuedTo", + "issuedAt", + "validFrom", + "monthlyIngestGb", + "monthlyQueryGbHours", + "apiRateLimitPerSecond", + "maxUsers", + "maxTeams", + "maxDatasets", + "maxMonitors", + "maxFields", + "maxEndpoints", + "maxQueryWindowSeconds", + "maxAuditWindowSeconds", + "withRBAC", + "withAuths", + "features" + ], + "properties": { + "apiRateLimitPerSecond": { + "type": "integer", + "format": "uint64" + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "features": { + "type": "object", + "additionalProperties": { + "type": "boolean" + } + }, + "id": { + "type": "string" + }, + "issuedAt": { + "type": "string", + "format": "date-time" + }, + "issuedTo": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "maxAuditWindowSeconds": { + "type": "integer", + "format": "uint64" + }, + "maxDatasets": { + "type": "integer", + "format": "uint64" + }, + "maxEndpoints": { + "type": "integer", + "format": "uint64" + }, + "maxFields": { + "type": "integer", + "format": "uint64" + }, + "maxMonitors": { + "type": "integer", + "format": "uint64" + }, + "maxQueryWindowSeconds": { + "type": "integer", + "format": "uint64" + }, + "maxTeams": { + "type": "integer", + "format": "uint64" + }, + "maxUsers": { + "type": "integer", + "format": "uint64" + }, + "monthlyIngestGb": { + "type": "integer", + "format": "uint64" + }, + "monthlyQueryGbHours": { + "type": "integer", + "format": "uint64" + }, + "monthlyStorageGb": { + "type": "integer", + "format": "uint64" + }, + "tier": { + "type": "string", + "enum": [ + "personal", + "basicDirect", + "teamMonthlyDirect", + "teamMonthlyAws", + "axiomCloud", + "teamPlus", + "enterprise", + "comped" + ] + }, + "validFrom": { + "type": "string", + "format": "date-time" + }, + "withAuths": { "type": "array", "items": { "type": "string" } - } - } - }, - "FieldInfo": { - "type": "object", - "title": "FieldInfo captures information about a field used in the tabular result format. See Table.", - "properties": { - "agg": { - "$ref": "#/components/schemas/AggInfo" - }, - "name": { - "type": "string" }, - "type": { - "type": "string" + "withRBAC": { + "type": "boolean" } } }, - "GroupInfo": { + "Lookup": { "type": "object", - "title": "GroupInfo captures information about a grouping clause in the tabular result format. See Table.", "properties": { - "name": { - "type": "string" + "rows": { + "type": "array", + "items": { + "type": "array", + "items": {} + } + }, + "schema": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } } } }, @@ -1154,6 +2319,9 @@ "notifyByGroup": { "type": "boolean" }, + "notifyEveryRun": { + "type": "boolean" + }, "operator": { "type": "string", "enum": [ @@ -1177,6 +2345,9 @@ "format": "int64", "maximum": 86400 }, + "skipResolved": { + "type": "boolean" + }, "threshold": { "type": "number", "format": "double", @@ -1337,6 +2508,81 @@ } } }, + "Org": { + "type": "object", + "required": [ + "id", + "name", + "plan", + "planCreated", + "lastUsageSync", + "paymentStatus", + "role", + "primaryEmail", + "license", + "externalPlan" + ], + "properties": { + "externalPlan": { + "$ref": "#/components/schemas/ExternalPlan" + }, + "firstFailedPayment": { + "type": "string" + }, + "id": { + "type": "string" + }, + "lastUsageSync": { + "type": "string" + }, + "license": { + "$ref": "#/components/schemas/License" + }, + "metaCreated": { + "type": "string" + }, + "metaModified": { + "type": "string" + }, + "metaVersion": { + "type": "string" + }, + "name": { + "type": "string" + }, + "paymentStatus": { + "type": "string", + "enum": [ + "na", + "failed", + "success", + "blocked" + ] + }, + "plan": { + "type": "string", + "enum": [ + "personal", + "basicDirect", + "teamMonthlyDirect", + "teamMonthlyAws", + "axiomCloud", + "teamPlus", + "enterprise", + "comped" + ] + }, + "planCreated": { + "type": "string" + }, + "primaryEmail": { + "type": "string" + }, + "role": { + "type": "string" + } + } + }, "PagerDutyConfig": { "properties": { "routingKey": { @@ -1347,6 +2593,17 @@ } } }, + "PostOrg": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + } + }, "RangeInfo": { "type": "object", "title": "RangeInfo specifies the window a query was restricted to.", @@ -1386,6 +2643,126 @@ } } }, + "Repo": { + "type": "object", + "properties": { + "createdBy": { + "description": "UUID of the user or system that created the object.", + "type": "string", + "format": "uuid" + }, + "data": { + "description": "Data specific to the type of repo object.", + "type": "string" + }, + "global": { + "description": "Indicates whether the object is global.", + "type": "boolean" + }, + "id": { + "description": "The unique identifier for the object.", + "type": "string" + }, + "resourceId": { + "description": "The unique identifier for the associated resource object.", + "type": "string" + }, + "type": { + "description": "The type of the object.", + "type": "string", + "enum": [ + "PACKAGE", + "DATASET", + "MONITOR", + "DASHBOARD", + "VIRTUAL_FIELD", + "APL_MODULE_DEFINITION", + "VIEW" + ] + } + } + }, + "ShareRequest": { + "type": "object", + "properties": { + "canWrite": { + "type": "boolean" + }, + "expiryDate": { + "description": "Optional time which the link will expire", + "type": "string", + "format": "date-time" + }, + "organizationIds": { + "description": "Optional list of organization IDs to restrict access to the shared link.", + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "description": "The type of the object.", + "type": "string", + "enum": [ + "PACKAGE", + "DATASET", + "MONITOR", + "DASHBOARD", + "VIRTUAL_FIELD", + "REGEX", + "QUERY", + "CONSTANT", + "MAPPING", + "VIEW" + ] + } + } + }, + "ShareResponse": { + "type": "object", + "properties": { + "canWrite": { + "type": "boolean" + }, + "expiryDate": { + "description": "Optional time which the link will expire", + "type": "string", + "format": "date-time" + }, + "id": { + "description": "The unique identifier for the object.", + "type": "string" + }, + "organizationIds": { + "description": "Optional list of organization IDs with access to the shared link.", + "type": "array", + "items": { + "type": "string" + } + }, + "shareableLink": { + "description": "The URL that can be used to access the shared repo.", + "type": "string" + }, + "token": { + "type": "string" + }, + "type": { + "description": "The type of the object.", + "type": "string", + "enum": [ + "PACKAGE", + "DATASET", + "MONITOR", + "DASHBOARD", + "VIRTUAL_FIELD", + "REGEX", + "QUERY", + "VIEW" + ] + } + } + }, "SlackConfig": { "properties": { "slackUrl": { @@ -1694,6 +3071,52 @@ } } }, + "VirtualField": { + "type": "object", + "required": [ + "dataset", + "name", + "expression" + ], + "properties": { + "dataset": { + "type": "string" + }, + "description": { + "type": "string" + }, + "expression": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "unit": { + "type": "string" + } + } + }, + "VirtualFieldWithId": { + "allOf": [ + { + "$ref": "#/components/schemas/VirtualField" + }, + { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + } + ] + }, "WebhookConfig": { "properties": { "url": { @@ -1738,6 +3161,19 @@ }, "x-omitempty": true }, + "share": { + "description": "Sharing dataset capability", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "delete" + ] + }, + "x-omitempty": true + }, "starredQueries": { "description": "Starred queries capability", "type": "array", @@ -1982,6 +3418,51 @@ ] }, "x-omitempty": true + }, + "views": { + "description": "Views capability", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + } + } + }, + "viewCapabilities": { + "type": "object", + "additionalProperties": { + "properties": { + "query": { + "description": "Query capability", + "type": "array", + "items": { + "type": "string", + "enum": [ + "read" + ] + }, + "x-omitempty": true + }, + "share": { + "description": "Sharing view capability", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "delete" + ] + }, + "x-omitempty": true + } } } } From b430faff4dfcf1b7219e7bef043423ad2012b9dd Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Tue, 11 Feb 2025 16:26:08 +0100 Subject: [PATCH 07/11] Merge from other PR --- restapi/endpoints/createMonitor.mdx | 2 +- restapi/endpoints/createUser.mdx | 2 +- restapi/endpoints/deleteMonitor.mdx | 2 +- restapi/endpoints/deleteNotifier.mdx | 2 +- restapi/endpoints/deleteUser.mdx | 2 +- restapi/endpoints/getMonitor.mdx | 2 +- restapi/endpoints/getMonitors.mdx | 2 +- restapi/endpoints/getNotifier.mdx | 2 +- restapi/endpoints/getNotifiers.mdx | 2 +- restapi/endpoints/getUser.mdx | 2 +- restapi/endpoints/getUsers.mdx | 2 +- restapi/endpoints/updateMonitor.mdx | 2 +- restapi/endpoints/updateNotifier.mdx | 2 +- restapi/endpoints/updateUser.mdx | 10 +++++++-- restapi/manage-resources/manage-users.mdx | 25 +++++++++++++++-------- 15 files changed, 38 insertions(+), 23 deletions(-) diff --git a/restapi/endpoints/createMonitor.mdx b/restapi/endpoints/createMonitor.mdx index 5f2db20f..02a94517 100644 --- a/restapi/endpoints/createMonitor.mdx +++ b/restapi/endpoints/createMonitor.mdx @@ -1,4 +1,4 @@ --- -title: Create Monitor +title: Create monitor openapi: "v2 post /monitors" --- \ No newline at end of file diff --git a/restapi/endpoints/createUser.mdx b/restapi/endpoints/createUser.mdx index 0ad12b73..33f5bc99 100644 --- a/restapi/endpoints/createUser.mdx +++ b/restapi/endpoints/createUser.mdx @@ -1,4 +1,4 @@ --- -title: Create User +title: Create user openapi: "v2 post /users" --- \ No newline at end of file diff --git a/restapi/endpoints/deleteMonitor.mdx b/restapi/endpoints/deleteMonitor.mdx index 3e408e3c..62e727b2 100644 --- a/restapi/endpoints/deleteMonitor.mdx +++ b/restapi/endpoints/deleteMonitor.mdx @@ -1,4 +1,4 @@ --- -title: Delete Monitor +title: Delete monitor openapi: "v2 delete /monitors/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/deleteNotifier.mdx b/restapi/endpoints/deleteNotifier.mdx index a78c6662..6de26062 100644 --- a/restapi/endpoints/deleteNotifier.mdx +++ b/restapi/endpoints/deleteNotifier.mdx @@ -1,4 +1,4 @@ --- -title: Delete Notifier +title: Delete notifier openapi: "v2 delete /notifiers/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/deleteUser.mdx b/restapi/endpoints/deleteUser.mdx index f119d59c..b6825a7c 100644 --- a/restapi/endpoints/deleteUser.mdx +++ b/restapi/endpoints/deleteUser.mdx @@ -1,4 +1,4 @@ --- -title: Delete User +title: Delete user openapi: "v2 delete /users/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/getMonitor.mdx b/restapi/endpoints/getMonitor.mdx index e91f348b..b9ac0848 100644 --- a/restapi/endpoints/getMonitor.mdx +++ b/restapi/endpoints/getMonitor.mdx @@ -1,4 +1,4 @@ --- -title: Retrieve Monitor +title: Retrieve monitor openapi: "v2 get /monitors/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/getMonitors.mdx b/restapi/endpoints/getMonitors.mdx index 189aa039..e289fa96 100644 --- a/restapi/endpoints/getMonitors.mdx +++ b/restapi/endpoints/getMonitors.mdx @@ -1,4 +1,4 @@ --- -title: List All Monitors +title: List all monitors openapi: "v2 get /monitors" --- \ No newline at end of file diff --git a/restapi/endpoints/getNotifier.mdx b/restapi/endpoints/getNotifier.mdx index 387eece3..a939cc4a 100644 --- a/restapi/endpoints/getNotifier.mdx +++ b/restapi/endpoints/getNotifier.mdx @@ -1,4 +1,4 @@ --- -title: Retrieve Notifier +title: Retrieve notifier openapi: "v2 get /notifiers/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/getNotifiers.mdx b/restapi/endpoints/getNotifiers.mdx index 1db168a2..9ee7becc 100644 --- a/restapi/endpoints/getNotifiers.mdx +++ b/restapi/endpoints/getNotifiers.mdx @@ -1,4 +1,4 @@ --- -title: List All Notifiers +title: List all notifiers openapi: "v2 get /notifiers" --- \ No newline at end of file diff --git a/restapi/endpoints/getUser.mdx b/restapi/endpoints/getUser.mdx index 4636881d..59c60bef 100644 --- a/restapi/endpoints/getUser.mdx +++ b/restapi/endpoints/getUser.mdx @@ -1,4 +1,4 @@ --- -title: Retrieve User +title: Retrieve user openapi: "v2 get /users/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/getUsers.mdx b/restapi/endpoints/getUsers.mdx index e3396bd2..b049f00b 100644 --- a/restapi/endpoints/getUsers.mdx +++ b/restapi/endpoints/getUsers.mdx @@ -1,4 +1,4 @@ --- -title: List All Users +title: List all users openapi: "v2 get /users" --- \ No newline at end of file diff --git a/restapi/endpoints/updateMonitor.mdx b/restapi/endpoints/updateMonitor.mdx index b98c841a..96927a1b 100644 --- a/restapi/endpoints/updateMonitor.mdx +++ b/restapi/endpoints/updateMonitor.mdx @@ -1,4 +1,4 @@ --- -title: Update Monitor +title: Update monitor openapi: "v2 put /monitors/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/updateNotifier.mdx b/restapi/endpoints/updateNotifier.mdx index 9e612472..f3e09ca3 100644 --- a/restapi/endpoints/updateNotifier.mdx +++ b/restapi/endpoints/updateNotifier.mdx @@ -1,4 +1,4 @@ --- -title: Update Notifier +title: Update notifier openapi: "v2 put /notifiers/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/updateUser.mdx b/restapi/endpoints/updateUser.mdx index e6afe5dc..0ca09c7a 100644 --- a/restapi/endpoints/updateUser.mdx +++ b/restapi/endpoints/updateUser.mdx @@ -1,4 +1,10 @@ --- -title: Update User +title: Update user openapi: "v2 put /users/{id}" ---- \ No newline at end of file +--- + + +Using this endpoint, you can change the name of your own user. Authorize the request with a [personal access token (PAT)](/reference/tokens). + +You cannot change the names of other users, you cannot change properties other than your name, and you cannot use an API token to authorize the request. + \ No newline at end of file diff --git a/restapi/manage-resources/manage-users.mdx b/restapi/manage-resources/manage-users.mdx index 0078b4ab..a4bf8b0e 100644 --- a/restapi/manage-resources/manage-users.mdx +++ b/restapi/manage-resources/manage-users.mdx @@ -11,13 +11,15 @@ This page explains how to manage users programmatically via the API. {/* list separator */} -- [Create an API token in Axiom](/reference/tokens) with permissions to create, read, update, and delete datasets. +- [Create an API token in Axiom](/reference/tokens) with permissions to create, read, update, and delete users. - In the code samples below, replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable. ## Create users To create a user, send a POST request to the `users` endpoint. In the body of the request, specify the following: -- `name` +- `name` +- `email` +- `role` For example: @@ -115,15 +117,22 @@ For more information, see the [API reference](/restapi/endpoints/getUser). ## Update users -To update a user, send a PUT request to the `users/ID` endpoint where `ID` is the unique ID of the user. In the body of the request, specify the properties you want to update. Include the `name` field even if you don’t want to change it. For example: +To update the name of your own user, send a PUT request to the `users/ID` endpoint where `ID` is the unique ID of your user. + + +Using this endpoint, you can change the name of your own user. Authorize the request with a [personal access token (PAT)](/reference/tokens). + +You cannot change the names of other users, you cannot change properties other than your name, and you cannot use an API token to authorize the request. + + +In the body of the request, specify the new name in the `name` field. For example: ```bash curl -X 'PUT' 'https://api.axiom.co/v2/users/abc123' \ -H 'Content-Type: application/json' \ --H 'Authorization: Bearer API_TOKEN' \ +-H 'Authorization: Bearer PERSONAL_ACCESS_TOKEN' \ -d '{ - "name": "test_user", - "email": "example2@abc.com", + "name": "test_user2" }' ``` @@ -131,9 +140,9 @@ Example response: ```json { - "email": "example2@abc.com", + "email": "example@abc.com", "id": "abc123", - "name": "test_user", + "name": "test_user2", "role": { "id": "admin", "name": "admin" From 8121c2919358d764940838ce47b4712ab961cef3 Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Tue, 11 Feb 2025 21:06:13 +0100 Subject: [PATCH 08/11] Update docs.json --- docs.json | 63 +++++++++++++++++++++------- restapi/endpoints/createNotifier.mdx | 2 +- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/docs.json b/docs.json index e9383c6b..1a2c0a98 100644 --- a/docs.json +++ b/docs.json @@ -478,9 +478,33 @@ ] }, { - "group": "User endpoints", + "group": "Manage resources", + "pages": [ + "restapi/manage-resources/overview", + "restapi/manage-resources/manage-datasets", + "restapi/manage-resources/manage-monitors", + "restapi/manage-resources/manage-notifiers", + "restapi/manage-resources/manage-users" + ] + }, + { + "group": "Annotation endpoints", "pages": [ - "restapi/endpoints/getCurrentUser" + "restapi/endpoints/getAnnotations", + "restapi/endpoints/getAnnotation", + "restapi/endpoints/createAnnotation", + "restapi/endpoints/updateAnnotation", + "restapi/endpoints/deleteAnnotation" + ] + }, + { + "group": "API token endpoints", + "pages": [ + "restapi/endpoints/getTokens", + "restapi/endpoints/getToken", + "restapi/endpoints/createToken", + "restapi/endpoints/regenerateToken", + "restapi/endpoints/deleteToken" ] }, { @@ -498,23 +522,34 @@ ] }, { - "group": "Annotation endpoints", + "group": "Monitor endpoints", "pages": [ - "restapi/endpoints/getAnnotations", - "restapi/endpoints/getAnnotation", - "restapi/endpoints/createAnnotation", - "restapi/endpoints/updateAnnotation", - "restapi/endpoints/deleteAnnotation" + "restapi/endpoints/getMonitors", + "restapi/endpoints/getMonitor", + "restapi/endpoints/createMonitor", + "restapi/endpoints/updateMonitor", + "restapi/endpoints/deleteMonitor" ] }, { - "group": "API token endpoints", + "group": "Notifier endpoints", "pages": [ - "restapi/endpoints/getTokens", - "restapi/endpoints/getToken", - "restapi/endpoints/createToken", - "restapi/endpoints/regenerateToken", - "restapi/endpoints/deleteToken" + "restapi/endpoints/getNotifiers", + "restapi/endpoints/getNotifier", + "restapi/endpoints/createNotifier", + "restapi/endpoints/updateNotifier", + "restapi/endpoints/deleteNotifier" + ] + }, + { + "group": "User endpoints", + "pages": [ + "restapi/endpoints/getCurrentUser", + "restapi/endpoints/getUsers", + "restapi/endpoints/getUser", + "restapi/endpoints/createUser", + "restapi/endpoints/updateUser", + "restapi/endpoints/deleteUser" ] } ] diff --git a/restapi/endpoints/createNotifier.mdx b/restapi/endpoints/createNotifier.mdx index f1fa201a..8ba1293d 100644 --- a/restapi/endpoints/createNotifier.mdx +++ b/restapi/endpoints/createNotifier.mdx @@ -1,4 +1,4 @@ --- -title: Create Notifier +title: Create notifier openapi: "v2 post /notifiers" --- \ No newline at end of file From aab9f4fcc9f1646beaf5d3967e328dde7e84ccd6 Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Thu, 10 Apr 2025 10:20:14 +0200 Subject: [PATCH 09/11] Add latest V2 version Update v2.json --- restapi/endpoints/deleteDataset.mdx | 2 +- restapi/endpoints/getDataset.mdx | 2 +- restapi/endpoints/trimDataset.mdx | 2 +- restapi/endpoints/updateDataset.mdx | 2 +- restapi/versions/v2.json | 1496 +++++++++++++++++++++++---- 5 files changed, 1302 insertions(+), 202 deletions(-) diff --git a/restapi/endpoints/deleteDataset.mdx b/restapi/endpoints/deleteDataset.mdx index 0376b114..28971cfb 100644 --- a/restapi/endpoints/deleteDataset.mdx +++ b/restapi/endpoints/deleteDataset.mdx @@ -1,4 +1,4 @@ --- title: Delete dataset -openapi: "v2 delete /datasets/{dataset_name}" +openapi: "v2 delete /datasets/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/getDataset.mdx b/restapi/endpoints/getDataset.mdx index d72243e6..dc65ba53 100644 --- a/restapi/endpoints/getDataset.mdx +++ b/restapi/endpoints/getDataset.mdx @@ -1,4 +1,4 @@ --- title: Retrieve dataset -openapi: "v2 get /datasets/{dataset_name}" +openapi: "v2 get /datasets/{id}" --- \ No newline at end of file diff --git a/restapi/endpoints/trimDataset.mdx b/restapi/endpoints/trimDataset.mdx index 2bb14195..ce2fa7ca 100644 --- a/restapi/endpoints/trimDataset.mdx +++ b/restapi/endpoints/trimDataset.mdx @@ -1,4 +1,4 @@ --- title: Trim dataset -openapi: "v2 post /datasets/{dataset_name}/trim" +openapi: "v2 post /datasets/{id}/trim" --- \ No newline at end of file diff --git a/restapi/endpoints/updateDataset.mdx b/restapi/endpoints/updateDataset.mdx index d15d62b4..246b8cff 100644 --- a/restapi/endpoints/updateDataset.mdx +++ b/restapi/endpoints/updateDataset.mdx @@ -1,4 +1,4 @@ --- title: Update dataset -openapi: "v2 put /datasets/{dataset_name}" +openapi: "v2 put /datasets/{id}" --- \ No newline at end of file diff --git a/restapi/versions/v2.json b/restapi/versions/v2.json index e26aa243..13007c1e 100644 --- a/restapi/versions/v2.json +++ b/restapi/versions/v2.json @@ -438,7 +438,7 @@ } } }, - "401": { + "403": { "$ref": "#/components/responses/ForbiddenError" } }, @@ -489,7 +489,7 @@ } } }, - "401": { + "403": { "$ref": "#/components/responses/ForbiddenError" } }, @@ -498,13 +498,6 @@ }, "/datasets/{id}": { "get": { - "security": [ - { - "Auth": [ - "datasets|delete" - ] - } - ], "description": "Get dataset by ID", "tags": [ "Datasets" @@ -532,7 +525,7 @@ } } }, - "401": { + "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { @@ -586,7 +579,7 @@ } } }, - "401": { + "403": { "$ref": "#/components/responses/ForbiddenError" } }, @@ -620,7 +613,7 @@ "204": { "description": "(empty)" }, - "401": { + "403": { "$ref": "#/components/responses/ForbiddenError" } }, @@ -638,7 +631,7 @@ ], "description": "Trim dataset", "tags": [ - "Datasets" + "datasets" ], "summary": "Trim dataset by duration", "operationId": "trimDataset", @@ -666,7 +659,7 @@ "204": { "description": "TrimResult" }, - "401": { + "403": { "$ref": "#/components/responses/ForbiddenError" }, "404": { @@ -676,6 +669,174 @@ "x-axiom-preview": true } }, + "/datasets/{id}/vacuum": { + "post": { + "security": [ + { + "Auth": [ + "vacuum|update" + ] + } + ], + "tags": [ + "datasets" + ], + "operationId": "vacuumDataset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "VacuumResult" + }, + "429": { + "description": "TooManyVacuumRequests", + "headers": { + "Retry-After": { + "description": "The GMT date/time at which the current rate limit window resets.\n", + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/datasets/{id}/fields": { + "get": { + "tags": [ + "datasets" + ], + "operationId": "getFieldsForDataset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "List of fields in the dataset", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DatasetField" + } + } + } + } + }, + "403": { + "$ref": "#/components/responses/ForbiddenError" + } + } + } + }, + "/datasets/{id}/fields/{fieldId}": { + "get": { + "tags": [ + "datasets" + ], + "operationId": "getFieldForDataset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "fieldId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "DatasetField", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DatasetField" + } + } + } + } + } + }, + "put": { + "security": [ + { + "Auth": [ + "datasets|update" + ] + } + ], + "tags": [ + "datasets" + ], + "operationId": "updateFieldForDataset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "fieldId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DatasetField" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "DatasetField", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DatasetField" + } + } + } + } + } + } + }, "/monitors": { "get": { "security": [ @@ -685,7 +846,7 @@ ] } ], - "description": "Get monitors", + "description": "Lists all configured monitors. Returns an array of monitor configurations including their IDs and current status.", "tags": [ "Monitors" ], @@ -698,7 +859,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/Monitor" + "$ref": "#/components/schemas/MonitorWithId" } } } @@ -729,7 +890,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Monitor" + "$ref": "#/components/schemas/MonitorWithId" } } } @@ -747,13 +908,14 @@ ] } ], - "description": "Get monitor by ID", + "description": "Retrieves detailed configuration for a specific monitor by its unique identifier", "tags": [ "Monitors" ], "operationId": "getMonitor", "parameters": [ { + "description": "Unique identifier of the monitor (format: mon_*)", "name": "id", "in": "path", "required": true, @@ -768,13 +930,12 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Monitor" + "$ref": "#/components/schemas/MonitorWithId" } } } } - }, - "x-axiom-preview": true + } }, "put": { "security": [ @@ -808,7 +969,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Monitor" + "$ref": "#/components/schemas/MonitorWithId" } } } @@ -847,6 +1008,68 @@ "x-axiom-preview": true } }, + "/monitors/{id}/history": { + "get": { + "security": [ + { + "Auth": [ + "monitors|read" + ] + } + ], + "description": "Get monitor history", + "tags": [ + "Monitors" + ], + "operationId": "getMonitorHistory", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "Start time (ISO 8601 format) for filtering alert history.", + "name": "startTime", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "description": "End time (ISO 8601 format) for filtering alert history.", + "name": "endTime", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "date-time" + } + } + ], + "responses": { + "200": { + "description": "AlertHistory", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AlertHistory" + } + } + } + } + } + }, + "x-axiom-preview": true + } + }, "/notifiers": { "get": { "security": [ @@ -856,20 +1079,20 @@ ] } ], - "description": "Get notifiers", + "description": "Lists all configured notifiers. Returns an array of notification configurations including their IDs and current status.", "tags": [ "Monitors" ], "operationId": "getNotifiers", "responses": { "200": { - "description": "Notifier", + "description": "Successfully retrieved list of notifiers", "content": { "application/json": { "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/Notifier" + "$ref": "#/components/schemas/NotifierWithId" } } } @@ -886,13 +1109,21 @@ ] } ], - "description": "Create notifier", + "description": "Creates a new notifier configuration for sending alerts through various channels (Slack, Email, etc)", "tags": [ "Monitors" ], "operationId": "createNotifier", "requestBody": { - "$ref": "#/components/requestBodies/Notifier" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notifier" + } + } + }, + "description": "Notifier configuration details", + "required": true }, "responses": { "200": { @@ -900,7 +1131,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Notifier" + "$ref": "#/components/schemas/NotifierWithId" } } } @@ -918,13 +1149,14 @@ ] } ], - "description": "Get notifier by ID", + "description": "Retrieves detailed configuration for a specific notifier by its unique identifier", "tags": [ "Monitors" ], "operationId": "getNotifier", "parameters": [ { + "description": "Unique identifier of the notifier (format: notify_*)", "name": "id", "in": "path", "required": true, @@ -939,7 +1171,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Notifier" + "$ref": "#/components/schemas/NotifierWithId" } } } @@ -971,7 +1203,14 @@ } ], "requestBody": { - "$ref": "#/components/requestBodies/Notifier" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notifier" + } + } + }, + "required": true }, "responses": { "200": { @@ -979,7 +1218,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Notifier" + "$ref": "#/components/schemas/NotifierWithId" } } } @@ -1039,6 +1278,37 @@ }, "x-axiom-no-org-required": true, "x-axiom-preview": true + }, + "post": { + "description": "Update current user", + "tags": [ + "Users" + ], + "operationId": "updateCurrentUser", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateCurrentUserRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "User", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/User" + } + } + } + } + }, + "x-axiom-no-org-required": true, + "x-axiom-preview": true } }, "/users": { @@ -1150,67 +1420,19 @@ }, "x-axiom-preview": true }, - "put": { + "delete": { "security": [ { "Auth": [ - "users|update" + "users|delete" ] } ], - "description": "Update user", + "description": "Remove user from org", "tags": [ "Users" ], - "operationId": "updateUser", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserUpdate" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "User", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - } - }, - "x-axiom-no-org-required": true, - "x-axiom-preview": true - }, - "delete": { - "security": [ - { - "Auth": [ - "users|delete" - ] - } - ], - "description": "Delete user", - "tags": [ - "Users" - ], - "operationId": "deleteUser", + "operationId": "removeUserFromOrg", "parameters": [ { "name": "id", @@ -1257,7 +1479,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserRole" + "$ref": "#/components/schemas/UpdateUserRoleRequest" } } }, @@ -1329,8 +1551,8 @@ } }, "example": { - "code": 401, - "message": "Unauthorized" + "code": 403, + "message": "Forbidden" } } } @@ -1380,21 +1602,21 @@ }, "required": true }, - "Monitor": { + "StarredQuery": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Monitor" + "$ref": "#/components/schemas/StarredQuery" } } }, "required": true }, - "Notifier": { + "Monitor": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Notifier" + "$ref": "#/components/schemas/Monitor" } } }, @@ -1471,6 +1693,65 @@ } } }, + "APLRequestWithOptions": { + "type": "object", + "required": [ + "apl" + ], + "properties": { + "apl": { + "type": "string" + }, + "cursor": { + "type": "string" + }, + "defaultLimit": { + "type": "integer", + "format": "int64" + }, + "defaultOrder": { + "type": "array", + "items": { + "$ref": "#/components/schemas/APLRequestWithOptionsDefaultOrder" + } + }, + "endTime": { + "type": "string" + }, + "includeCursor": { + "type": "boolean" + }, + "includeCursorField": { + "type": "boolean" + }, + "libraries": { + "type": "array", + "items": { + "type": "string" + } + }, + "queryOptions": { + "$ref": "#/components/schemas/QueryOptions" + }, + "startTime": { + "type": "string" + }, + "variables": { + "type": "object" + } + } + }, + "APLRequestWithOptionsDefaultOrder": { + "type": "object", + "properties": { + "desc": { + "type": "boolean" + }, + "field": { + "type": "string" + } + } + }, "AggInfo": { "description": "AggInfo captures information about an aggregation", "type": "object", @@ -1494,6 +1775,7 @@ } }, "AlertHistory": { + "description": "Historical record of an alert's state changes.\nTracks when alerts are opened and closed, allowing for incident timeline analysis.\n", "type": "object", "required": [ "name", @@ -1503,25 +1785,29 @@ ], "properties": { "checkId": { - "description": "ID of the check that triggered the alert.", - "type": "string" + "description": "Unique identifier of the check that triggered the alert", + "type": "string", + "example": "chk_abc123" }, "name": { - "description": "The name of the alert.", - "type": "string" + "description": "The name of the alert", + "type": "string", + "example": "High CPU Usage Alert" }, "state": { - "description": "State of the alert.", + "description": "Current state of the alert", "type": "string", "enum": [ "open", "closed" - ] + ], + "example": "open" }, "timestamp": { - "description": "Timestamp of the transition into the current state.", + "description": "ISO 8601 timestamp when the alert state changed", "type": "string", - "format": "date-time" + "format": "date-time", + "example": "2024-03-20T15:30:00Z" } } }, @@ -1880,14 +2166,26 @@ "name": { "description": "Dataset unique name", "type": "string" + }, + "retentionDays": { + "description": "Number of days to retain data in the dataset", + "type": "integer", + "x-omitempty": false + }, + "useRetentionPeriod": { + "description": "Whether to use the retention period", + "type": "boolean", + "x-omitempty": false } }, "example": { "description": "string", - "name": "string" + "name": "string", + "retentionDays": 30 } }, "CreateUserRequest": { + "description": "Object representing a new user creation request", "type": "object", "required": [ "name", @@ -1896,17 +2194,24 @@ ], "properties": { "email": { - "type": "string" + "description": "Email address of the new user", + "type": "string", + "example": "jane.doe@example.com" }, "name": { - "type": "string" + "description": "Full name of the new user", + "type": "string", + "example": "Jane Doe" }, "role": { - "type": "string" + "description": "Role to assign to the new user", + "type": "string", + "example": "member" } } }, "CustomNotifierConfig": { + "description": "Configuration for custom webhook notifications with flexible headers and body template.\nSupports variable substitution in the body template using {{.Variable}} syntax.\n", "type": "object", "required": [ "url", @@ -1914,25 +2219,47 @@ ], "properties": { "body": { - "type": "string" + "description": "Template for the webhook body, supports variable substitution", + "type": "string", + "example": "{\"alert\": \"{{.AlertName}}\", \"severity\": \"{{.Severity}}\", \"message\": \"{{.Message}}\"}" }, "headers": { + "description": "HTTP headers to include in the request", "type": "object", "additionalProperties": { "type": "string" + }, + "example": { + "Content-Type": "application/json", + "X-API-Version": "1.0" } }, "secretHeaders": { + "description": "Sensitive HTTP headers (tokens, keys) that should be masked in logs", "type": "object", "additionalProperties": { "type": "string" + }, + "example": { + "Authorization": "Bearer {{token}}" } }, "url": { - "type": "string" + "description": "Custom webhook endpoint URL", + "type": "string", + "example": "https://api.custom-service.com/alerts" } } }, + "DashboardID": { + "type": "string", + "x-go-type": { + "import": { + "package": "github.com/axiomhq/axiom/pkg/core/ids" + }, + "type": "DashboardID" + } + }, "Dataset": { "type": "object", "required": [ @@ -1943,6 +2270,10 @@ "who" ], "properties": { + "canWrite": { + "description": "Whether this dataset has write access", + "type": "boolean" + }, "created": { "description": "The RFC3339-formatted time when the dataset was created.", "type": "string", @@ -1960,10 +2291,20 @@ "description": "Unique dataset name", "type": "string" }, + "retentionDays": { + "description": "Number of days to retain data in the dataset", + "type": "integer", + "x-omitempty": false + }, "sharedByOrg": { "description": "ID of the org that shared this resource, if it's shared", "type": "string" }, + "useRetentionPeriod": { + "description": "Whether to use the retention period", + "type": "boolean", + "x-omitempty": false + }, "who": { "description": "Name of the dataset creator", "type": "string" @@ -1977,30 +2318,73 @@ "who": "string" } }, + "DatasetField": { + "type": "object", + "required": [ + "name", + "type" + ], + "properties": { + "description": { + "description": "Description of the field", + "type": "string" + }, + "hidden": { + "description": "Whether the field is hidden", + "type": "boolean" + }, + "name": { + "description": "Name of the field", + "type": "string" + }, + "type": { + "description": "Type of the field", + "type": "string" + }, + "unit": { + "description": "Unit of the field", + "type": "string" + } + } + }, "DiscordConfig": { + "description": "Configuration for Discord notifications using bot token", "properties": { "discordChannel": { - "type": "string" + "description": "Discord channel ID to send notifications", + "type": "string", + "example": "123456789012345678" }, "discordToken": { - "type": "string" + "description": "Discord bot token for authentication", + "type": "string", + "example": "123456789012345678" } } }, "DiscordWebhookConfig": { + "description": "Configuration for Discord notifications using webhooks", "properties": { "discordWebhookUrl": { - "type": "string" + "description": "Discord webhook URL", + "type": "string", + "example": "https://discord.com/api/webhooks/123456789012345678/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" } } }, "EmailConfig": { + "description": "Configuration for email notifications", "properties": { "emails": { + "description": "List of email addresses to receive notifications", "type": "array", "items": { "type": "string" - } + }, + "example": [ + "oncall@example.com", + "alerts@example.com" + ] } } }, @@ -2067,6 +2451,42 @@ } } }, + "Group": { + "description": "Defines a group of users for organizational purposes", + "type": "object", + "required": [ + "name" + ], + "properties": { + "description": { + "description": "Detailed description of the group's purpose and scope", + "type": "string" + }, + "isManaged": { + "description": "Whether the group is managed by Axiom", + "type": "boolean", + "readOnly": true + }, + "members": { + "description": "List of user IDs that are assigned to this group", + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "description": "Unique name identifier for the group", + "type": "string" + }, + "roles": { + "description": "List of role IDs that are assigned to this group", + "type": "array", + "items": { + "type": "string" + } + } + } + }, "GroupInfo": { "type": "object", "title": "GroupInfo captures information about a grouping clause in the tabular result format. See Table.", @@ -2076,6 +2496,26 @@ } } }, + "GroupWithID": { + "description": "Extends the base Group type to include a unique identifier", + "allOf": [ + { + "$ref": "#/components/schemas/Group" + }, + { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "description": "Unique identifier for the group", + "type": "string" + } + } + } + ] + }, "License": { "type": "object", "required": [ @@ -2089,14 +2529,12 @@ "monthlyQueryGbHours", "apiRateLimitPerSecond", "maxUsers", - "maxTeams", "maxDatasets", "maxMonitors", "maxFields", "maxEndpoints", "maxQueryWindowSeconds", "maxAuditWindowSeconds", - "withRBAC", "withAuths", "features" ], @@ -2153,10 +2591,6 @@ "type": "integer", "format": "uint64" }, - "maxTeams": { - "type": "integer", - "format": "uint64" - }, "maxUsers": { "type": "integer", "format": "uint64" @@ -2169,7 +2603,7 @@ "type": "integer", "format": "uint64" }, - "monthlyStorageGb": { + "storageAllowanceGB": { "type": "integer", "format": "uint64" }, @@ -2195,9 +2629,6 @@ "items": { "type": "string" } - }, - "withRBAC": { - "type": "boolean" } } }, @@ -2255,74 +2686,109 @@ } }, "MicrosoftTeamsConfig": { + "description": "Configuration for Microsoft Teams notifications", "properties": { "microsoftTeamsUrl": { - "type": "string" + "description": "Microsoft Teams webhook URL", + "type": "string", + "example": "https://outlook.office.com/webhook/123456789/IncomingWebhook/..." } } }, "Monitor": { + "description": "Configuration for a monitoring rule. Monitors can be configured to:\n- Check threshold values (e.g., CPU usage > 90%)\n- Match specific events in logs\n- Detect anomalies based on historical patterns\nEach monitor runs on a specified interval and can trigger notifications through configured notifiers.\n", "type": "object", "required": [ - "name" + "name", + "type", + "aplQuery" ], "properties": { "alertOnNoData": { - "type": "boolean" + "description": "Whether to alert when no data is received", + "type": "boolean", + "example": true }, "aplQuery": { - "type": "string" + "description": "APL (Axiom Processing Language) query string used for monitoring.\nThis query defines what data to analyze and how to process it.\n", + "type": "string", + "example": "| where severity = 'error' | count() > 100" }, "columnName": { - "type": "string" + "description": "Name of the column to monitor", + "type": "string", + "example": "cpu_usage" }, "compareDays": { + "description": "Number of days to compare for anomaly detection", "type": "number", "format": "int64", - "maximum": 7 + "maximum": 7, + "example": 7 }, "createdAt": { + "description": "Timestamp when the monitor was created", "type": "string", - "format": "date-time" + "format": "date-time", + "example": "2024-03-20T10:00:00Z" }, "createdBy": { - "type": "string" + "description": "ID of the user who created the monitor", + "type": "string", + "example": "usr_789xyz" }, "description": { - "type": "string" + "description": "Detailed description of the monitor's purpose", + "type": "string", + "example": "Monitors CPU usage and alerts when it exceeds 90%" }, "disabled": { - "type": "boolean" + "description": "Whether the monitor is currently disabled", + "type": "boolean", + "example": false }, "disabledUntil": { + "description": "Timestamp until when the monitor should remain disabled", "type": "string", "format": "date-time", + "example": "2024-04-01T00:00:00Z", "nullable": true }, - "id": { - "type": "string" - }, "intervalMinutes": { + "description": "How frequently the monitor should run, in minutes.\nMinimum value is 1 minute.\n", "type": "integer", "format": "int64", - "minimum": 1 + "minimum": 1, + "example": 5 }, "name": { - "type": "string" + "description": "Name of the monitor", + "type": "string", + "example": "Production CPU Monitor" }, "notifierIds": { + "description": "List of notifier IDs that will receive alerts.\nNotifiers can be email, Slack, webhook endpoints, etc.\n", "type": "array", "items": { "type": "string" - } + }, + "example": [ + "notify_slack_prod", + "notify_email_oncall" + ] }, "notifyByGroup": { - "type": "boolean" + "description": "Whether to group notifications", + "type": "boolean", + "example": false }, "notifyEveryRun": { - "type": "boolean" + "description": "Whether to send notifications on every check", + "type": "boolean", + "example": false }, "operator": { + "description": "Comparison operator for threshold checks:\n- Below: Trigger when value < threshold\n- BelowOrEqual: Trigger when value <= threshold\n- Above: Trigger when value > threshold\n- AboveOrEqual: Trigger when value >= threshold\n- AboveOrBelow: Trigger when value is outside a range\n", "type": "string", "enum": [ "Below", @@ -2330,61 +2796,101 @@ "Above", "AboveOrEqual", "AboveOrBelow" - ] + ], + "example": "Above" }, "rangeMinutes": { + "description": "Time window to evaluate in each check, in minutes.\nFor example, \"last 5 minutes of data\"\n", "type": "integer", "format": "int64", - "minimum": 1 + "minimum": 1, + "example": 5 }, "resolvable": { - "type": "boolean" + "description": "Whether the alert can be manually resolved", + "type": "boolean", + "example": true }, "secondDelay": { + "description": "Delay in seconds before triggering the alert", "type": "number", "format": "int64", - "maximum": 86400 + "maximum": 86400, + "example": 300 }, "skipResolved": { - "type": "boolean" + "description": "Whether to skip resolved alerts", + "type": "boolean", + "example": false }, "threshold": { + "description": "Threshold value for triggering the alert", "type": "number", "format": "double", - "x-omitempty": false + "x-omitempty": false, + "example": 90 }, "tolerance": { + "description": "Tolerance percentage for anomaly detection", "type": "number", - "maximum": 100 + "maximum": 100, + "example": 10 }, "triggerAfterNPositiveResults": { + "description": "Number of positive results needed before triggering", "type": "number", - "format": "int64" + "format": "int64", + "example": 2 }, "triggerFromNRuns": { + "description": "Number of consecutive check runs that must fail before triggering an alert.\nUse this to avoid alerting on temporary spikes.\n", "type": "number", - "format": "int64" + "format": "int64", + "example": 3 }, "type": { + "description": "Type of monitoring check to perform:\n- Threshold: Compares a numeric value against a threshold\n- MatchEvent: Looks for specific events or patterns\n- AnomalyDetection: Identifies unusual patterns based on historical data\n", "type": "string", "enum": [ "Threshold", "MatchEvent", "AnomalyDetection" - ] + ], + "example": "Threshold" } } }, - "NewAnnotation": { - "type": "object", - "required": [ - "datasets", - "type" - ], - "properties": { - "datasets": { - "description": "array of dataset names for which the annotation appears on charts", - "type": "array", + "MonitorWithId": { + "description": "Monitor configuration with its unique identifier", + "allOf": [ + { + "$ref": "#/components/schemas/Monitor" + }, + { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "description": "Unique identifier for the monitor", + "type": "string", + "example": "mon_xyz789" + } + } + } + ] + }, + "NewAnnotation": { + "type": "object", + "required": [ + "datasets", + "type" + ], + "properties": { + "datasets": { + "description": "array of dataset names for which the annotation appears on charts", + "type": "array", "items": { "type": "string" } @@ -2423,6 +2929,7 @@ } }, "Notifier": { + "description": "Configuration for a notification channel. Notifiers can be configured for various services like:\n- Slack\n- Email\n- PagerDuty\n- OpsGenie\n- Discord\n- Microsoft Teams\n- Custom Webhooks\n", "type": "object", "required": [ "name", @@ -2430,22 +2937,27 @@ ], "properties": { "createdAt": { + "description": "Timestamp when the notifier was created", "type": "string", "format": "date-time", - "readOnly": true + "readOnly": true, + "example": "2024-01-15T10:30:00Z" }, "createdBy": { + "description": "Email or ID of the user who created the notifier", "type": "string", - "readOnly": true + "readOnly": true, + "example": "alice@example.com" }, "disabledUntil": { - "type": "string" - }, - "id": { - "type": "string" + "description": "ISO timestamp until which the notifier is disabled (null if enabled)", + "type": "string", + "example": "2024-03-20T15:00:00Z" }, "name": { - "type": "string" + "description": "Human-readable name for the notifier", + "type": "string", + "example": "Production Slack Alerts" }, "properties": { "$ref": "#/components/schemas/NotifierProperties" @@ -2453,6 +2965,7 @@ } }, "NotifierProperties": { + "description": "Configuration options for different notification channels. Only one channel should be configured per notifier.", "properties": { "customWebhook": { "$ref": "#/components/schemas/CustomNotifierConfig" @@ -2483,13 +2996,39 @@ } } }, + "NotifierWithId": { + "description": "Notifier configuration with its unique identifier", + "allOf": [ + { + "$ref": "#/components/schemas/Notifier" + }, + { + "properties": { + "id": { + "description": "Unique identifier for the notifier", + "type": "string", + "example": "notify_slack_prod" + } + } + } + ] + }, + "OTELResponse": { + "type": "string", + "format": "binary" + }, "OpsGenieConfig": { + "description": "Configuration for OpsGenie integration", "properties": { "apiKey": { - "type": "string" + "description": "OpsGenie API key for authentication", + "type": "string", + "example": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }, "isEU": { - "type": "boolean" + "description": "Whether to use EU region endpoints", + "type": "boolean", + "example": true } } }, @@ -2517,9 +3056,8 @@ "planCreated", "lastUsageSync", "paymentStatus", - "role", - "primaryEmail", "license", + "primaryEmail", "externalPlan" ], "properties": { @@ -2584,12 +3122,17 @@ } }, "PagerDutyConfig": { + "description": "Configuration for PagerDuty integration", "properties": { "routingKey": { - "type": "string" + "description": "PagerDuty integration key for routing alerts", + "type": "string", + "example": "1234567890abcdef1234567890abcdef" }, "token": { - "type": "string" + "description": "PagerDuty API token for additional functionality", + "type": "string", + "example": "u+1234567890abcdef1234567890abcdef" } } }, @@ -2604,6 +3147,48 @@ } } }, + "QueryOptions": { + "type": "object", + "properties": { + "disableCache": { + "type": "boolean" + }, + "disableStats": { + "type": "boolean" + }, + "disableTrace": { + "type": "boolean" + }, + "maxDataPoints": { + "type": "integer", + "format": "int64" + }, + "maxSeries": { + "type": "integer", + "format": "int64" + }, + "noAggregation": { + "type": "boolean" + }, + "noFill": { + "type": "boolean" + }, + "noInterpolation": { + "type": "boolean" + }, + "priority": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "resolution": { + "type": "string" + } + } + }, "RangeInfo": { "type": "object", "title": "RangeInfo specifies the window a query was restricted to.", @@ -2682,6 +3267,59 @@ } } }, + "Role": { + "description": "Defines a role and its associated permissions within the system", + "type": "object", + "required": [ + "name" + ], + "properties": { + "datasetCapabilities": { + "$ref": "#/components/schemas/roleDatasetCapabilities" + }, + "description": { + "description": "Detailed description of the role's purpose and scope", + "type": "string" + }, + "members": { + "description": "List of user IDs that are assigned to this role", + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "description": "Unique name identifier for the role", + "type": "string" + }, + "orgCapabilities": { + "$ref": "#/components/schemas/roleOrgCapabilities" + }, + "viewCapabilities": { + "$ref": "#/components/schemas/roleViewCapabilities" + } + } + }, + "RoleWithID": { + "description": "Extends the base Role type to include a unique identifier", + "allOf": [ + { + "$ref": "#/components/schemas/Role" + }, + { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "description": "Unique identifier for the role", + "type": "string" + } + } + } + ] + }, "ShareRequest": { "type": "object", "properties": { @@ -2764,9 +3402,12 @@ } }, "SlackConfig": { + "description": "Configuration for Slack notifications using incoming webhooks", "properties": { "slackUrl": { - "type": "string" + "description": "Slack incoming webhook URL", + "type": "string", + "example": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" } } }, @@ -2850,6 +3491,61 @@ } } }, + "StarredQuery": { + "type": "object", + "required": [ + "kind", + "name", + "who", + "query", + "metadata" + ], + "properties": { + "dataset": { + "type": "string" + }, + "kind": { + "type": "string", + "enum": [ + "apl" + ] + }, + "metadata": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "name": { + "type": "string" + }, + "query": { + "$ref": "#/components/schemas/APLRequestWithOptions" + }, + "who": { + "type": "string" + } + } + }, + "StarredQueryWithId": { + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/StarredQuery" + }, + { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + } + ] + }, "Status": { "type": "object", "required": [ @@ -2946,6 +3642,28 @@ } } }, + "TokenInfo": { + "type": "object", + "properties": { + "expiryDate": { + "description": "Optional time which the link will expire", + "type": "string", + "format": "date-time" + }, + "ownerEmail": { + "description": "Email of the owner.", + "type": "string" + }, + "resourceId": { + "description": "The unique identifier for the associated resource object.", + "type": "string" + }, + "resourceType": { + "description": "The type of the resource.", + "type": "string" + } + } + }, "TrimOptions": { "type": "object", "required": [ @@ -2961,15 +3679,54 @@ "maxDuration": "1h" } }, + "UpdateCurrentUserRequest": { + "description": "Object representing a user update request", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "New name for the user", + "type": "string", + "example": "John Smith" + } + } + }, "UpdateDataset": { "type": "object", "properties": { "description": { "type": "string" + }, + "retentionDays": { + "description": "Number of days to retain data in the dataset", + "type": "integer", + "x-omitempty": false + }, + "useRetentionPeriod": { + "description": "Whether to use the retention period", + "type": "boolean", + "x-omitempty": false } }, "example": { - "description": "string" + "description": "string", + "retentionDays": 30 + } + }, + "UpdateUserRoleRequest": { + "description": "Object representing a user's role update request", + "type": "object", + "required": [ + "role" + ], + "properties": { + "role": { + "description": "Role identifier to assign to the user", + "type": "string", + "example": "admin" + } } }, "UpdatedAnnotation": { @@ -3017,6 +3774,7 @@ } }, "User": { + "description": "Represents a user in the system", "type": "object", "required": [ "id", @@ -3026,13 +3784,19 @@ ], "properties": { "email": { - "type": "string" + "description": "User's email address", + "type": "string", + "example": "john.doe@example.com" }, "id": { - "type": "string" + "description": "Unique identifier for the user", + "type": "string", + "example": "usr_123456789" }, "name": { - "type": "string" + "description": "User's full name", + "type": "string", + "example": "John Doe" }, "role": { "$ref": "#/components/schemas/UserDetailsRole" @@ -3040,34 +3804,22 @@ } }, "UserDetailsRole": { - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "UserRole": { - "type": "object", - "required": [ - "role" - ], - "properties": { - "role": { - "type": "string" - } - } - }, - "UserUpdate": { + "description": "Detailed information about a user's role", "type": "object", "required": [ + "id", "name" ], "properties": { + "id": { + "description": "Unique identifier for the role", + "type": "string", + "example": "role_123456789" + }, "name": { - "type": "string" + "description": "Human-readable name of the role", + "type": "string", + "example": "Organization Admin" } } }, @@ -3118,9 +3870,12 @@ ] }, "WebhookConfig": { + "description": "Configuration for simple webhook notifications", "properties": { "url": { - "type": "string" + "description": "Webhook endpoint URL", + "type": "string", + "example": "https://api.example.com/webhooks/alerts" } } }, @@ -3435,6 +4190,351 @@ } } }, + "roleDatasetCapabilities": { + "description": "Defines the available permissions for dataset operations", + "type": "object", + "additionalProperties": { + "properties": { + "data": { + "description": "Controls data management operations like deletion", + "type": "array", + "items": { + "type": "string", + "enum": [ + "delete" + ] + }, + "x-omitempty": true + }, + "ingest": { + "description": "Controls the ability to ingest data into datasets", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create" + ] + }, + "x-omitempty": true + }, + "query": { + "description": "Controls the ability to query and read data from datasets", + "type": "array", + "items": { + "type": "string", + "enum": [ + "read" + ] + }, + "x-omitempty": true + }, + "share": { + "description": "Controls the ability to share datasets with other users", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "delete" + ] + }, + "x-omitempty": true + }, + "starredQueries": { + "description": "Controls the management of starred/saved queries", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "trim": { + "description": "Controls data trimming operations for storage optimization", + "type": "array", + "items": { + "type": "string", + "enum": [ + "update" + ] + }, + "x-omitempty": true + }, + "vacuum": { + "description": "Controls field vacuuming operations for storage optimization", + "type": "array", + "items": { + "type": "string", + "enum": [ + "update" + ] + }, + "x-omitempty": true + }, + "virtualFields": { + "description": "Controls the management of virtual fields in datasets", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + } + } + } + }, + "roleOrgCapabilities": { + "description": "Defines organization-wide permissions and capabilities", + "type": "object", + "properties": { + "annotations": { + "description": "Controls the management of annotations across the organization", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "apiTokens": { + "description": "Controls the management of API tokens for authentication", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "auditLog": { + "description": "Controls access to organization audit logs", + "type": "array", + "items": { + "type": "string", + "enum": [ + "read" + ] + }, + "x-omitempty": true + }, + "billing": { + "description": "Controls access to billing information and settings", + "type": "array", + "items": { + "type": "string", + "enum": [ + "read", + "update" + ] + }, + "x-omitempty": true + }, + "dashboards": { + "description": "Controls the management of organization dashboards", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "datasets": { + "description": "Controls the management of organization datasets", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "endpoints": { + "description": "Controls the management of API endpoints", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "flows": { + "description": "Controls the management of data flows and pipelines", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "integrations": { + "description": "Controls the management of third-party integrations", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "monitors": { + "description": "Controls the management of monitoring", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "notifiers": { + "description": "Controls the management of notification settings", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "rbac": { + "description": "Controls access to role-based access control settings", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "sharedAccessKeys": { + "description": "Controls the management of shared access keys", + "type": "array", + "items": { + "type": "string", + "enum": [ + "read", + "update" + ] + }, + "x-omitempty": true + }, + "users": { + "description": "Controls user management within the organization", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + }, + "views": { + "description": "Controls the management of data views", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "update", + "delete" + ] + }, + "x-omitempty": true + } + } + }, + "roleViewCapabilities": { + "description": "Defines the available permissions for view operations", + "type": "object", + "additionalProperties": { + "properties": { + "query": { + "description": "Controls the ability to query and read data from views", + "type": "array", + "items": { + "type": "string", + "enum": [ + "read" + ] + }, + "x-omitempty": true + }, + "share": { + "description": "Controls the ability to share views with other users", + "type": "array", + "items": { + "type": "string", + "enum": [ + "create", + "read", + "delete" + ] + }, + "x-omitempty": true + } + } + } + }, "viewCapabilities": { "type": "object", "additionalProperties": { From 32b7d264438dbdf9b712e315c415db2b3963dfd2 Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Thu, 10 Apr 2025 14:31:57 +0200 Subject: [PATCH 10/11] Add latest version of all new endpoints --- restapi/versions/v2.json | 1357 +++++++++++++++++++++++++++++++------- 1 file changed, 1110 insertions(+), 247 deletions(-) diff --git a/restapi/versions/v2.json b/restapi/versions/v2.json index 13007c1e..50d0741a 100644 --- a/restapi/versions/v2.json +++ b/restapi/versions/v2.json @@ -217,189 +217,6 @@ } } }, - "/tokens": { - "get": { - "security": [ - { - "Auth": [ - "apiTokens|read" - ] - } - ], - "description": "Get API tokens", - "tags": [ - "tokens" - ], - "operationId": "getAPITokens", - "responses": { - "200": { - "description": "Token", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/APIToken" - } - } - } - } - } - } - }, - "post": { - "security": [ - { - "Auth": [ - "apiTokens|create" - ] - } - ], - "description": "Create API token", - "tags": [ - "tokens" - ], - "operationId": "createAPIToken", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAPIToken" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "CreateApiTokenResponse", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAPITokenResponse" - } - } - } - } - }, - "x-axiom-not-suspended": true - } - }, - "/tokens/{id}": { - "get": { - "security": [ - { - "Auth": [ - "apiTokens|read" - ] - } - ], - "description": "Get API token by ID", - "tags": [ - "tokens" - ], - "operationId": "getAPIToken", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Token", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/APIToken" - } - } - } - } - } - }, - "delete": { - "security": [ - { - "Auth": [ - "apiTokens|delete" - ] - } - ], - "description": "Delete API token", - "tags": [ - "tokens" - ], - "operationId": "deleteAPIToken", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "204": { - "description": "(empty)" - } - } - } - }, - "/tokens/{id}/regenerate": { - "post": { - "security": [ - { - "Auth": [ - "apiTokens|update" - ] - } - ], - "description": "Regenerate API token", - "tags": [ - "tokens" - ], - "operationId": "regenerateAPIToken", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RegenerateAPIToken" - } - } - } - }, - "responses": { - "200": { - "description": "CreateAPITokenResponse", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateAPITokenResponse" - } - } - } - } - }, - "x-axiom-not-suspended": true - } - }, "/datasets": { "get": { "description": "Get list of datasets", @@ -1113,50 +930,932 @@ "tags": [ "Monitors" ], - "operationId": "createNotifier", + "operationId": "createNotifier", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notifier" + } + } + }, + "description": "Notifier configuration details", + "required": true + }, + "responses": { + "200": { + "description": "Notifier", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotifierWithId" + } + } + } + } + }, + "x-axiom-preview": true + } + }, + "/notifiers/{id}": { + "get": { + "security": [ + { + "Auth": [ + "notifiers|read" + ] + } + ], + "description": "Retrieves detailed configuration for a specific notifier by its unique identifier", + "tags": [ + "Monitors" + ], + "operationId": "getNotifier", + "parameters": [ + { + "description": "Unique identifier of the notifier (format: notify_*)", + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Notifier", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotifierWithId" + } + } + } + } + }, + "x-axiom-preview": true + }, + "put": { + "security": [ + { + "Auth": [ + "notifiers|update" + ] + } + ], + "description": "Update notifier", + "tags": [ + "Monitors" + ], + "operationId": "updateNotifier", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Notifier" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Notifier", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotifierWithId" + } + } + } + } + }, + "x-axiom-preview": true + }, + "delete": { + "security": [ + { + "Auth": [ + "notifiers|delete" + ] + } + ], + "description": "Delete notifier", + "tags": [ + "Monitors" + ], + "operationId": "deleteNotifier", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "(empty)" + } + }, + "x-axiom-preview": true + } + }, + "/orgs": { + "get": { + "security": [ + { + "Auth": [] + } + ], + "tags": [ + "orgs" + ], + "operationId": "getOrgs", + "responses": { + "200": { + "description": "Org", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Org" + } + } + } + } + } + }, + "x-axiom-no-org-required": true + }, + "post": { + "security": [ + { + "Auth": [] + } + ], + "tags": [ + "orgs" + ], + "operationId": "createOrg", + "requestBody": { + "$ref": "#/components/requestBodies/PostOrg" + }, + "responses": { + "200": { + "description": "Org", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Org" + } + } + } + } + }, + "x-axiom-no-org-required": true + } + }, + "/orgs/{id}": { + "get": { + "security": [ + { + "Auth": [] + } + ], + "tags": [ + "orgs" + ], + "operationId": "getOrg", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Org", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Org" + } + } + } + } + } + }, + "put": { + "security": [ + { + "Auth": [] + } + ], + "tags": [ + "orgs" + ], + "operationId": "updateOrg", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/PostOrg" + }, + "responses": { + "200": { + "description": "Org", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Org" + } + } + } + } + } + } + }, + "/rbac/roles": { + "get": { + "security": [ + { + "Auth": [ + "rbac|read" + ] + } + ], + "description": "Retrieves all roles in the organization with their associated permissions and members.", + "tags": [ + "rbac" + ], + "summary": "List all roles", + "operationId": "listRoles", + "responses": { + "200": { + "description": "A list of roles was successfully retrieved", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RoleWithID" + } + } + } + } + } + } + }, + "post": { + "security": [ + { + "Auth": [ + "rbac|create" + ] + } + ], + "description": "Creates a new role in the organization with the specified permissions and member assignments.", + "tags": [ + "rbac" + ], + "summary": "Create role", + "operationId": "createRole", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + }, + "description": "The role configuration containing name, description, members, and capability settings", + "required": true + }, + "responses": { + "200": { + "description": "The role was successfully created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleWithID" + } + } + } + } + } + } + }, + "/rbac/roles/{id}": { + "get": { + "security": [ + { + "Auth": [ + "rbac|read" + ] + } + ], + "description": "Retrieves detailed information about a specific role by its unique identifier.", + "tags": [ + "rbac" + ], + "summary": "Get role by ID", + "operationId": "getRoleById", + "parameters": [ + { + "description": "Unique identifier of the role to retrieve", + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The role was successfully retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleWithID" + } + } + } + } + } + }, + "put": { + "security": [ + { + "Auth": [ + "rbac|create" + ] + } + ], + "description": "Updates an existing role's configuration including its permissions and member assignments.", + "tags": [ + "rbac" + ], + "summary": "Update role", + "operationId": "updateRole", + "parameters": [ + { + "description": "Unique identifier of the role to update", + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Role" + } + } + }, + "description": "The updated role configuration", + "required": true + }, + "responses": { + "200": { + "description": "The role was successfully updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleWithID" + } + } + } + } + } + }, + "delete": { + "security": [ + { + "Auth": [ + "rbac|create" + ] + } + ], + "description": "Permanently removes a role from the organization.", + "tags": [ + "rbac" + ], + "summary": "Delete role", + "operationId": "deleteRole", + "parameters": [ + { + "description": "Unique identifier of the role to delete", + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The role was successfully deleted" + } + } + } + }, + "/rbac/groups": { + "get": { + "security": [ + { + "Auth": [ + "rbac|read" + ] + } + ], + "description": "Retrieves all groups in the organization.", + "tags": [ + "rbac" + ], + "summary": "List all groups", + "operationId": "listGroups", + "responses": { + "200": { + "description": "A list of groups was successfully retrieved", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GroupWithID" + } + } + } + } + } + } + }, + "post": { + "security": [ + { + "Auth": [ + "rbac|create" + ] + } + ], + "description": "Creates a new group in the organization.", + "tags": [ + "rbac" + ], + "summary": "Create group", + "operationId": "createGroup", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Group" + } + } + }, + "description": "The group configuration", + "required": true + }, + "responses": { + "200": { + "description": "The group was successfully created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupWithID" + } + } + } + } + } + } + }, + "/rbac/groups/{id}": { + "get": { + "security": [ + { + "Auth": [ + "rbac|read" + ] + } + ], + "description": "Retrieves detailed information about a specific group by its unique identifier.", + "tags": [ + "rbac" + ], + "summary": "Get group by ID", + "operationId": "getGroupById", + "parameters": [ + { + "description": "Unique identifier of the group to retrieve", + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The group was successfully retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupWithID" + } + } + } + } + } + }, + "put": { + "security": [ + { + "Auth": [ + "rbac|create" + ] + } + ], + "description": "Updates an existing group's configuration.", + "tags": [ + "rbac" + ], + "summary": "Update group", + "operationId": "updateGroup", + "parameters": [ + { + "description": "Unique identifier of the group to update", + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Group" + } + } + }, + "description": "The updated group configuration", + "required": true + }, + "responses": { + "200": { + "description": "The group was successfully updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupWithID" + } + } + } + } + } + }, + "delete": { + "security": [ + { + "Auth": [ + "rbac|create" + ] + } + ], + "description": "Permanently removes a group from the organization.", + "tags": [ + "rbac" + ], + "summary": "Delete group", + "operationId": "deleteGroup", + "parameters": [ + { + "description": "Unique identifier of the group to delete", + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "The group was successfully deleted" + } + } + } + }, + "/apl-starred-queries": { + "get": { + "security": [ + { + "Auth": [ + "starredQueries|read" + ] + } + ], + "tags": [ + "starred" + ], + "operationId": "getStarredQueries", + "parameters": [ + { + "$ref": "#/components/parameters/Limit" + }, + { + "$ref": "#/components/parameters/Offset" + }, + { + "name": "dataset", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "description": "'all', 'team', or userID", + "name": "who", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "qs", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "StarredQueryWithId", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StarredQueryWithId" + } + } + } + } + } + } + }, + "post": { + "security": [ + { + "Auth": [ + "starredQueries|create" + ] + } + ], + "tags": [ + "starred" + ], + "operationId": "createStarred", + "requestBody": { + "$ref": "#/components/requestBodies/StarredQuery" + }, + "responses": { + "200": { + "description": "StarredQueryWithId", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StarredQueryWithId" + } + } + } + } + } + } + }, + "/apl-starred-queries/{id}": { + "get": { + "security": [ + { + "Auth": [ + "starredQueries|read" + ] + } + ], + "tags": [ + "starred" + ], + "operationId": "getStarred", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "StarredQueryWithId", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StarredQueryWithId" + } + } + } + } + } + }, + "put": { + "security": [ + { + "Auth": [ + "starredQueries|update" + ] + } + ], + "tags": [ + "starred" + ], + "operationId": "updateStarred", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/StarredQuery" + }, + "responses": { + "200": { + "description": "StarredQueryWithId", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StarredQueryWithId" + } + } + } + } + } + }, + "delete": { + "security": [ + { + "Auth": [ + "starredQueries|delete" + ] + } + ], + "tags": [ + "starred" + ], + "operationId": "deleteStarred", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "(empty)" + } + } + } + }, + "/tokens": { + "get": { + "security": [ + { + "Auth": [ + "apiTokens|read" + ] + } + ], + "description": "Get API tokens", + "tags": [ + "tokens" + ], + "operationId": "getAPITokens", + "responses": { + "200": { + "description": "Token", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/APIToken" + } + } + } + } + } + } + }, + "post": { + "security": [ + { + "Auth": [ + "apiTokens|create" + ] + } + ], + "description": "Create API token", + "tags": [ + "tokens" + ], + "operationId": "createAPIToken", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Notifier" + "$ref": "#/components/schemas/CreateAPIToken" } } }, - "description": "Notifier configuration details", "required": true }, "responses": { "200": { - "description": "Notifier", + "description": "CreateApiTokenResponse", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotifierWithId" + "$ref": "#/components/schemas/CreateAPITokenResponse" } } } } }, - "x-axiom-preview": true + "x-axiom-not-suspended": true } }, - "/notifiers/{id}": { + "/tokens/{id}": { "get": { "security": [ { "Auth": [ - "notifiers|read" + "apiTokens|read" ] } ], - "description": "Retrieves detailed configuration for a specific notifier by its unique identifier", + "description": "Get API token by ID", "tags": [ - "Monitors" + "tokens" ], - "operationId": "getNotifier", + "operationId": "getAPIToken", "parameters": [ { - "description": "Unique identifier of the notifier (format: notify_*)", "name": "id", "in": "path", "required": true, @@ -1167,31 +1866,30 @@ ], "responses": { "200": { - "description": "Notifier", + "description": "Token", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/NotifierWithId" + "$ref": "#/components/schemas/APIToken" } } } } - }, - "x-axiom-preview": true + } }, - "put": { + "delete": { "security": [ { "Auth": [ - "notifiers|update" + "apiTokens|delete" ] } ], - "description": "Update notifier", + "description": "Delete API token", "tags": [ - "Monitors" + "tokens" ], - "operationId": "updateNotifier", + "operationId": "deleteAPIToken", "parameters": [ { "name": "id", @@ -1202,43 +1900,27 @@ } } ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Notifier" - } - } - }, - "required": true - }, "responses": { - "200": { - "description": "Notifier", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NotifierWithId" - } - } - } + "204": { + "description": "(empty)" } - }, - "x-axiom-preview": true - }, - "delete": { + } + } + }, + "/tokens/{id}/regenerate": { + "post": { "security": [ { "Auth": [ - "notifiers|delete" + "apiTokens|update" ] } ], - "description": "Delete notifier", + "description": "Regenerate API token", "tags": [ - "Monitors" + "tokens" ], - "operationId": "deleteNotifier", + "operationId": "regenerateAPIToken", "parameters": [ { "name": "id", @@ -1249,12 +1931,28 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegenerateAPIToken" + } + } + } + }, "responses": { - "204": { - "description": "(empty)" + "200": { + "description": "CreateAPITokenResponse", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAPITokenResponse" + } + } + } } }, - "x-axiom-preview": true + "x-axiom-not-suspended": true } }, "/user": { @@ -1499,6 +2197,177 @@ }, "x-axiom-preview": true } + }, + "/vfields": { + "get": { + "security": [ + { + "Auth": [ + "virtualFields|read" + ] + } + ], + "tags": [ + "vfields" + ], + "operationId": "getVirtualFields", + "parameters": [ + { + "name": "dataset", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "VirtualFieldWithId", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VirtualFieldWithId" + } + } + } + } + } + } + }, + "post": { + "security": [ + { + "Auth": [ + "virtualFields|create" + ] + } + ], + "tags": [ + "vfields" + ], + "operationId": "createVirtualField", + "requestBody": { + "$ref": "#/components/requestBodies/VirtualField" + }, + "responses": { + "200": { + "description": "VirtualFieldWithId", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VirtualFieldWithId" + } + } + } + } + } + } + }, + "/vfields/{id}": { + "get": { + "security": [ + { + "Auth": [ + "virtualFields|read" + ] + } + ], + "tags": [ + "vfields" + ], + "operationId": "getVirtualField", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "VirtualFieldWithId", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VirtualFieldWithId" + } + } + } + } + } + }, + "put": { + "security": [ + { + "Auth": [ + "virtualFields|update" + ] + } + ], + "tags": [ + "vfields" + ], + "operationId": "updateVirtualField", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/VirtualField" + }, + "responses": { + "200": { + "description": "VirtualFieldWithId", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VirtualFieldWithId" + } + } + } + } + } + }, + "delete": { + "security": [ + { + "Auth": [ + "virtualFields|delete" + ] + } + ], + "tags": [ + "vfields" + ], + "operationId": "deleteVirtualField", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "(empty)" + } + } + } } }, "components": { @@ -2169,13 +3038,11 @@ }, "retentionDays": { "description": "Number of days to retain data in the dataset", - "type": "integer", - "x-omitempty": false + "type": "integer" }, "useRetentionPeriod": { "description": "Whether to use the retention period", - "type": "boolean", - "x-omitempty": false + "type": "boolean" } }, "example": { @@ -2293,8 +3160,7 @@ }, "retentionDays": { "description": "Number of days to retain data in the dataset", - "type": "integer", - "x-omitempty": false + "type": "integer" }, "sharedByOrg": { "description": "ID of the org that shared this resource, if it's shared", @@ -2302,8 +3168,7 @@ }, "useRetentionPeriod": { "description": "Whether to use the retention period", - "type": "boolean", - "x-omitempty": false + "type": "boolean" }, "who": { "description": "Name of the dataset creator", @@ -2358,7 +3223,7 @@ "discordToken": { "description": "Discord bot token for authentication", "type": "string", - "example": "123456789012345678" + "example": "Bot 123456789012345678" } } }, @@ -3701,13 +4566,11 @@ }, "retentionDays": { "description": "Number of days to retain data in the dataset", - "type": "integer", - "x-omitempty": false + "type": "integer" }, "useRetentionPeriod": { "description": "Whether to use the retention period", - "type": "boolean", - "x-omitempty": false + "type": "boolean" } }, "example": { From b7deec00284e4b4f58654ac500b1fcba543d051f Mon Sep 17 00:00:00 2001 From: Mano Toth Date: Thu, 10 Apr 2025 14:34:02 +0200 Subject: [PATCH 11/11] TODO tokens pages --- .../manage-resources/manage-annotations.mdx | 145 ++++++++++++++++++ .../manage-resources/manage-api-tokens.mdx | 145 ++++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 restapi/manage-resources/manage-annotations.mdx create mode 100644 restapi/manage-resources/manage-api-tokens.mdx diff --git a/restapi/manage-resources/manage-annotations.mdx b/restapi/manage-resources/manage-annotations.mdx new file mode 100644 index 00000000..7c7afd75 --- /dev/null +++ b/restapi/manage-resources/manage-annotations.mdx @@ -0,0 +1,145 @@ +--- +title: Manage datasets via API +sidebarTitle: "Datasets" +description: "Learn how to manage Axiom datasets via API." +tags: ['axiom documentation', 'documentation', 'axiom', 'axiom api', 'rest api', 'rest', 'authorization', 'headers', 'datasets', 'users', 'monitors', 'notifiers', 'response'] +--- + +import Prerequisites from "/snippets/minimal-prerequisites.mdx" + +This page explains how to manage datasets programmatically via the API. + +TODO + + +{/* list separator */} +- [Create an API token in Axiom](/reference/tokens) with permissions to create, read, update, and delete datasets. +- In the code samples below, replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable. + +## Create datasets + +To create a dataset, send a POST request to the `datasets` endpoint. In the body of the request, specify the name and the description of the dataset. For example: + +```bash +curl -X 'POST' 'https://api.axiom.co/v2/datasets' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "description": "This is a test dataset.", + "name": "test_dataset" + }' +``` + +The example response contains the dataset ID that you can later use to access the dataset programmatically. + +```json +{ + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" +} +``` + +For more information, see the [API reference](/restapi/endpoints/createDataset). + +## Get information about datasets + +### Get information about all datasets + +To get information about all the datasets in your Axiom organization, send a GET request to the `datasets` endpoint. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/datasets' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +The example response is a list of dataset objects. Each object contains a unique dataset ID that you can later use to access the dataset programmatically. + +```json +[ + { + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset1", + "name": "test_dataset1", + "who": "" + }, + { + "created": "2024-04-20T02:35:24.137Z", + "description": "This is another test dataset.", + "id": "test_dataset2", + "name": "test_dataset2", + "who": "" + } +] +``` + +For more information, see the [API reference](/restapi/endpoints/getDatasets). + +### Get information about specific dataset + +To get information about a specific dataset, send a GET request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +Example response: + +```json +[ + { + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" + }, +] +``` + +For more information, see the [API reference](/restapi/endpoints/getDataset). + +## Update datasets + +To update a dataset, send a PUT request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. In the body of the request, specify the properties you want to update. For example: + +```bash +curl -X 'PUT' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "description": "This is a production dataset." + }' +``` + +Example response: + +```json +{ + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a production dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" +} +``` + +For more information, see the [API reference](/restapi/endpoints/updateDataset). + +## Delete datasets + +To delete a dataset, send a DELETE request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. For example: + +```bash +curl -X 'DELETE' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +For more information, see the [API reference](/restapi/endpoints/deleteDataset). \ No newline at end of file diff --git a/restapi/manage-resources/manage-api-tokens.mdx b/restapi/manage-resources/manage-api-tokens.mdx new file mode 100644 index 00000000..7c7afd75 --- /dev/null +++ b/restapi/manage-resources/manage-api-tokens.mdx @@ -0,0 +1,145 @@ +--- +title: Manage datasets via API +sidebarTitle: "Datasets" +description: "Learn how to manage Axiom datasets via API." +tags: ['axiom documentation', 'documentation', 'axiom', 'axiom api', 'rest api', 'rest', 'authorization', 'headers', 'datasets', 'users', 'monitors', 'notifiers', 'response'] +--- + +import Prerequisites from "/snippets/minimal-prerequisites.mdx" + +This page explains how to manage datasets programmatically via the API. + +TODO + + +{/* list separator */} +- [Create an API token in Axiom](/reference/tokens) with permissions to create, read, update, and delete datasets. +- In the code samples below, replace `API_TOKEN` with the Axiom API token you have generated. For added security, store the API token in an environment variable. + +## Create datasets + +To create a dataset, send a POST request to the `datasets` endpoint. In the body of the request, specify the name and the description of the dataset. For example: + +```bash +curl -X 'POST' 'https://api.axiom.co/v2/datasets' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "description": "This is a test dataset.", + "name": "test_dataset" + }' +``` + +The example response contains the dataset ID that you can later use to access the dataset programmatically. + +```json +{ + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" +} +``` + +For more information, see the [API reference](/restapi/endpoints/createDataset). + +## Get information about datasets + +### Get information about all datasets + +To get information about all the datasets in your Axiom organization, send a GET request to the `datasets` endpoint. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/datasets' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +The example response is a list of dataset objects. Each object contains a unique dataset ID that you can later use to access the dataset programmatically. + +```json +[ + { + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset1", + "name": "test_dataset1", + "who": "" + }, + { + "created": "2024-04-20T02:35:24.137Z", + "description": "This is another test dataset.", + "id": "test_dataset2", + "name": "test_dataset2", + "who": "" + } +] +``` + +For more information, see the [API reference](/restapi/endpoints/getDatasets). + +### Get information about specific dataset + +To get information about a specific dataset, send a GET request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. For example: + +```bash +curl -X 'GET' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +Example response: + +```json +[ + { + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a test dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" + }, +] +``` + +For more information, see the [API reference](/restapi/endpoints/getDataset). + +## Update datasets + +To update a dataset, send a PUT request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. In the body of the request, specify the properties you want to update. For example: + +```bash +curl -X 'PUT' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' \ +-d '{ + "description": "This is a production dataset." + }' +``` + +Example response: + +```json +{ + "created": "2024-04-20T02:35:14.137Z", + "description": "This is a production dataset.", + "id": "test_dataset", + "name": "test_dataset", + "who": "" +} +``` + +For more information, see the [API reference](/restapi/endpoints/updateDataset). + +## Delete datasets + +To delete a dataset, send a DELETE request to the `datasets/ID` endpoint where `ID` is the unique ID of the dataset. For example: + +```bash +curl -X 'DELETE' 'https://api.axiom.co/v2/datasets/test_dataset' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer API_TOKEN' +``` + +For more information, see the [API reference](/restapi/endpoints/deleteDataset). \ No newline at end of file