Query data via Axiom API
Learn how to use Axiom querying API to create and get query objects.
Use Axiom querying API to create and get query objects.
Authorization and Headers
The only expected headers are the Authorization: Bearer
, which is your API or Personal Token. Learn more about API Token and Org ID.
Using Axiom Node.js library to query data
Axiom maintains the axiom-js to provide official Node.js bindings for the Axiom API.
Install using npm install
:
If you use the Axiom CLI, run eval $(axiom config export -f)
to configure your environment variables.
Otherwise create a personal token in the Axiom settings and export it as AXIOM_TOKEN
. Set AXIOM_ORG_ID
to the organization ID from the settings page of the organization you want to access.
Create and use a client like this:
In the above example we’re querying a dataset containing contemporary flight data obtained from an ADSB antenna. Results may look similar to this:
Further examples can be found in the axiom-js repo.
Querying via Curl using APL
This section provides a guide on how to leverage the power of APL through curl commands. By combining the flexibility of curl with the querying capabilities of APL, users can seamlessly fetch and analyze their data right from the terminal.
Whether you’re looking to fetch specific data points, aggregate metrics over time, or filter datasets based on certain criteria, the examples provided here will serve as a foundation to build upon. As you become more familiar with APL’s syntax and curl’s options, you’ll find that the possibilities are vast and the insights you can derive are profound.
Examples
Count of distinct routes
Top 5 routes by count
Average request duration
Requests with duration greater than 1 second
Top 3 routes with the highest average duration
Requests grouped by hour
Requests with errors
Getting the most common user agents
Identifying the server data centers with the highest number of requests
Identifying the average, minimum, and maximum request duration for each method type
Finding the top 3 URIs accessed via TLS connections with a response body size greater than a specified threshold
Calculating the 95th percentile of the request duration for each server datacenter
Active issue contributors
Top Issue Wranglers
Using Curl to query the API
POST api.axiom.co/v1/datasets/\{id\}/query
Response Example
Response code 200 and the response body:
Was this page helpful?