The v1/stats endpoint in the Clarisights API is requires the user to send a POST request with authentication to https://platform.adwyze.com/api/v1/stats along with associated parameters and operations; and returns the requested stats in JSON format.

Following are accepted parameters - 

"metrics" - This should contain the list of metrics to query in an array of strings. For example, "metrics": ["fb_spend", "aw_cost"] .

"dimensions" - This should contain the list of dimensions to query in an array of strings. For example, "dimensions": ["Account", "Campaign"] .

"filters" - This should contain the criteria to filter the records. Filters can be applied on both dimensions and metrics, and multiple filters at once are supported. Multiple filters should be sent as an array, in the following sample format -
[{ "metric": "<metric_name operand1)>", "operator": "<operator to apply>", "value": "<operand2>" },
{ "dimension": "<dimension_name (operand 1)>", "operator": "<operator to apply>", "value": "<operand2>" }]
 

For example,
[{"metric":"fb_spend", "operator":"$gt", "value":1000}, {"dimension":"account", "operator":"$in", "value":Performance}] 

List of supported operators for metrics and dimensions can be found below.

"date" - This should specify the required date range of the requested data, in the format {"endDate": "YYYY-MM-DD, "startDate": "YYYY-MM-DD"}. For example,  {"endDate":"2018-04-04", "startDate":"2018-03-08"}.

"page_size" - This should specify the maximum number of rows of results to be returned in the response. It should be a whole number.

"sort_columns" - This should specify the columns (metrics and/or dimensions) to sort the rows by. Multiple columns to sort by are supported, and should be sent in the preferred order as an array in the following format -
[{"<column1>":<sort_order>}, {"<column2>":<sort_order>}] 

For example,
[{"fb_spend": -1}, {"date": 1}]

The value of sort_order needs to be 1 for ascending, and -1 for descending.

"data_sources" - This should specify the chosen data sources to request the data from. Multiple channels and accounts are supported, and should be sent as an array in the following format -
[ "<channel1>":<account_id>, "<channel2>":<account_id1>, "<channel2>":<account_id2> ] 

If all accounts of a particular channel is required simply specify the name of the channel without any <account_id>.
For example,
[ "facebook", "adwords":133, "adwords":343 ] .

Following are the supported filter operators

Dimension Operators

Metric Operators

Did this answer your question?