Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to update the dataset you have created.
Query data with cURL
To query data with cURL:- Build the APL query. For more information, see Introduction to APL.
- Encode the APL query as a JSON object and enter it into the body of the API request.
- Optional: In the body of the request, set optional parameters such as
startTime
andendTime
. For more information, see the query data API reference. - Set the
Content-Type
header toapplication/json
. - Set the
Authorization
header toBearer API_TOKEN
. - Send the POST request to one of the following:
- For tabular output, use
https://AXIOM_DOMAIN/v1/datasets/_apl?format=tabular
. - For legacy output, use
https://AXIOM_DOMAIN/v1/datasets/_apl?format=legacy
.
- For tabular output, use
Example
Replace
AXIOM_DOMAIN
with api.axiom.co
if your organization uses the US region, and with api.eu.axiom.co
if your organization uses the EU region. For more information, see Regions.Replace API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME
with the name of the Axiom dataset where you send your data.Query data with Axiom Node.js
- Install and configure the Axiom Node.js library.
- Build the APL query. For more information, see Introduction to APL.
-
Pass the APL query as a string to the
axiom.query
function.ReplaceDATASET_NAME
with the name of the Axiom dataset where you send your data.