Getting started
This guide will go through the following steps and assumes you have already created your account at https://app.trckrspace.com (opens in a new tab):
- Create your first project
- Your project API key
- Your user API key
- Collecting your first event
- Retrieving your events
Create your first project
Once logged in on the dashboard your will a plus symbol. Click this and enter your project name (note: only alphanumeric, - and _ are allowed).
Your project API key
After creating your project you will see the button to "manage project". Once
clicked this will show you your project_api_key
. This key is used to
collect data for your project. Your allowed events per month are tracked
against this API key - it is important to keep this secret.
Your user APi Key
To find your user_api_key
you need to click the API Key tab from the sidebar.
Once loaded you can view and copy your user_api_key
. With your user_api_key
you can view events that you have collected.
Collecting your first event
You can now collect your first event in trckrspace. There are two required
fields order
and values
. The keys in order
and their respective values
can be used later to filter your data when retrieving it from the API.
Below is a python example:
import requests
url = 'https://api.trckrspace.com/usage'
project_api_key = "{ insert your key here }"
headers = {
'X-Api-Key': project_api_key,
}
event = {
'order': ['category', 'event', 'user_uuid'],
'values': {
# required properties as they exist in order
'category': 'authentication',
'event': 'user-sign-in',
'user_uuid': '123456789',
# unrestricted free additional properties
'location': 'London',
'2fa': true,
}
}
resp = requests.post(url, headers=headers, json=event)
print(resp)
>> <Response [200]>
Retrieving your events
After collecting an event you are ready to start retrieving them. To do this
you must specify a date range with startDt
and endDt
. You can then
optionally also filter with path parameters of the keys and values you previously
submitted in the order
property.
Below is an example in python:
import requests
url = 'https://api.trckrspace.com/usage'
user_api_key = "{ insert your key here }"
headers = {
'Authorization': f'Bearer {user_api_key}',
'Accept': 'application/json'
}
resp = requests.get(
f'{url}?startDt=2023-09-17&endDt=2023-09-18',
headers=headers
)
print(resp)
>> <Response [200]>
print(resp.json())
>> {
'status': 'OK',
'result': [
'dateTime': '2023-09-17T11:56:46.586306'
'category': 'authentication',
'event': 'user-sign-in',
'user_uuid': '123456789',
'location': 'London',
'2fa': true,
]
}
Filter with path parameters
resp = requests.get(
f'{url}/category?startDt=2023-09-17&endDt=2023-09-18',
headers=headers
)
print(resp)
>> <Response [200]>
print(resp.json())
>> {
'status': 'OK',
'result': [
'dateTime': '2023-09-17T11:56:46.586306'
'category': 'authentication',
'event': 'user-sign-in',
'user_uuid': '123456789',
'location': 'London',
'2fa': true,
]
}
resp = requests.get(
f'{url}/category/authentication?startDt=2023-09-17&endDt=2023-09-18',
headers=headers
)
print(resp)
>> <Response [200]>
print(resp.json())
>> {
'status': 'OK',
'result': [
'dateTime': '2023-09-17T11:56:46.586306'
'category': 'authentication',
'event': 'user-sign-in',
'user_uuid': '123456789',
'location': 'London',
'2fa': true,
]
}