diff --git a/mint.json b/mint.json index 2f9b4e3d..6e50690c 100644 --- a/mint.json +++ b/mint.json @@ -454,6 +454,16 @@ "restapi/api-limits" ] }, + { + "group": "Manage resources", + "pages": [ + "restapi/manage-resources/overview", + "restapi/manage-resources/manage-annotations", + "restapi/manage-resources/manage-api-tokens", + "restapi/manage-resources/manage-datasets", + "restapi/manage-resources/manage-users" + ] + }, { "group": "User endpoints", "pages": [ 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 diff --git a/restapi/manage-resources/manage-datasets.mdx b/restapi/manage-resources/manage-datasets.mdx new file mode 100644 index 00000000..35a02b23 --- /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-users.mdx b/restapi/manage-resources/manage-users.mdx new file mode 100644 index 00000000..a4bf8b0e --- /dev/null +++ b/restapi/manage-resources/manage-users.mdx @@ -0,0 +1,165 @@ +--- +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 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` +- `email` +- `role` + +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 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 PERSONAL_ACCESS_TOKEN' \ +-d '{ + "name": "test_user2" + }' +``` + +Example response: + +```json +{ + "email": "example@abc.com", + "id": "abc123", + "name": "test_user2", + "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..f6af1a2c --- /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: +- [Annotations](/restapi/manage-resources/manage-annotations) +- [API tokens](/restapi/manage-resources/manage-api-tokens) +- [Datasets](/restapi/manage-resources/manage-datasets) +- [Users](/restapi/manage-resources/manage-users) \ No newline at end of file