Data
The easiest way to use the Data API is to use the "Export as Data API Call" button in the visualizer tool. However you can find the official documentation below.
API Endpoint
https://www.graphjson.com/api/visualize/data
API Parameters
Field | Type | Description |
---|---|---|
api_key | string | your account api key |
collection | string | the collection you want to query data from |
IANA_time_zone | string | the time zone you want result dates formatted in |
graph_type | string | the type of graph you want data for |
start | string | where you want the query to begin |
end | string | where you want the query to end |
filters | array | list of filters to filter down the query |
metric | string | what metric you want to aggregate on |
aggregation | string | the type of aggregation you want to do |
granularity | string | the granularity of the data returned |
compare | string | the time period you want to compare against |
So for instance, in Python your code might look like
import requests
import json
import time
payload = {
"api_key": os.getenv('GRAPHJSON_API_KEY'),
"collection": "all_events",
"IANA_time_zone": "America/Los_Angeles",
"graph_type": "Single Line",
"start": "7 days ago",
"end": "now",
"filters": [],
"metric": None,
"aggregation": "Count",
"customizations": {"showYAxis":true,"showDots":true,"lineColor":"#987DE3","secondaryColor":"#9CA3AF"},
"granularity": "auto",
"compare": "7 days ago"
}
r = requests.post("https://www.graphjson.com/api/visualize/data", json=payload)