Quickstart
This page shows you how to get started with dashboards creation in mediarithmics.
To be able to see dashboards, you need the feature to be activated for your organisation.
This quickstart guide uses the Long term access tokens authentication method. Choose and configure your own authentication method. For more information, see Authentication.
Your dashboard could use OTQL queries or activities analytics queries to retrieve data. We will use both in this tutorial, and OTQL queries need to be registered using the Creating a query endpoint.
post
https://api.mediarithmics.com
/v1/datamarts/:datamartId/queries
Creating a query
We will create two OTQL queries for this tutorial. The first one counts the user points in the datamart, the second one lists the devices they use.
For each query, note their ID.
You should adapt those queries to your data model if required.
BODY payload for query 1
{
"datamart_id": {{datamartId}},
"query_language": "OTQL",
"query_text": "select @count{} FROM UserPoint"
}
BODY payload for query 2
{
"datamart_id": {{datamartId}},
"query_language": "OTQL",
"query_text": "SELECT {agents {user_agent_info{form_factor @map}}} FROM UserPoint"
}
You first create a DashboardRegistration object to reference your dashboard and define where it is visible.
post
https://api.mediarithmics.com/v1
/dashboards
Create a dashboard registration
Here is a sample body payload for a home dashboard with all the important properties
{
"title": "My awesome dashboards",
"scopes": [
"home"
],
"segment_ids": [],
"builder_ids": [],
"archived": false,
"organisation_id": "{{orgId}}",
"community_id": "{{communityId}}"
}
put
https://api.mediarithmics.com/v1
/dashboards/:id/content?organisation_id=:organisation_id
Edit the content of a dashboard
Here is a sample body payload for a content using the queries we previously created.
{
"sections": [
{
"title": "",
"cards": [
{
"x": 0,
"y": 0,
"h": 3,
"layout": "vertical",
"w": 8,
"charts": [
{
"title": "User points",
"type": "Metric",
"dataset": {
"type": "OTQL",
"query_id": "{{ID of query 1}}"
}
},
{
"title": "Device form factors",
"type": "Bars",
"dataset": {
"type": "OTQL",
"query_id": "{{ID of query 2}}"
},
"options": {}
}
]
}
]
}
]
}
Go to your datamart's home page, and your dashboard is now displayed with the two charts we created !

Last modified 1yr ago