“code” parameter

 

What is a short code?

When you save a Data Query template, it gives you a short code back. This short code is the short cut of the Data Query data set.
It is generally recommended to use short codes to ensure the best flexibility in reporting.

 

How do I alter a short-code API call?

By default, a short code will contain all of the items of the template: columns, sort, filters, site, etc.
If you need to change how the calls to the short code are sorted, it is possible to overload the short code in order to apply a new sort.

For example, here is our basic query:
https://apirest.atinternet-solutions.com/data/v2/xml/GetData?code=2MEu4z&period={D:2017-08-12}&max-results=30&page-num=1

Please refer to this note if you’re using SSO to login to AT Internet services.

You therefore need to change the way the calls to the short code are sorted, which is currently carried out in descending order on the metric “m_visits”. Should you need to sort this on another metric of the data set, just add it to the query as follows:
https://apirest.atinternet-solutions.com/data/v2/xml/GetData?code=2MEu4z&period={D:2017-08-12}&max-results=30&page-num=1&sort=-m_conversions1_visits

Please refer to this note if you’re using SSO to login to AT Internet services.

In the event of an overload on the columns parameter, all of the columns will be reset.

In the previous example the short code 2MEu4z contains the following columns: d_time_month,d_source,m_visits,m_conversions1_visits

During an overload, the short code will be as follows:
https://apirest.atinternet-solutions.com/data/v2/xml/GetData?code=2MEu4z&period={D:2017-08-12}&max-results=30&page-num=1&columns={d_page,m_visits}

Please refer to this note if you’re using SSO to login to AT Internet services.

The result will only be the visits for the “d_page” column, and not the entire set of columns from the short code 2MEu4z plus the “d_page” column.

Last update: 22/01/2019