This page explains how to manage datasets programmatically via the API.

Prerequisites

  • Create an API token in Axiom 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:

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.

{
  "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.

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:

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.

[
    {
    "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.

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:

curl -X 'GET' 'https://api.axiom.co/v2/datasets/test_dataset' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer API_TOKEN'

Example response:

[
    {
    "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.

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:

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:

{
  "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.

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:

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.