An API call requires certain conditions to be met in order to return data, otherwise it will not work and return an error, a list of which is available in the API documentation. There are several points to check.
As a general rule, we advise you to prepare your query on Data Query, then copy the automatically generated API call:
The Reporting API has several limitations:
columnsparameter: you can get up to 50 different items (properties + metrics) in this parameter,
max-resultsparameter: you can return up to 10,000 rows per API call (200,000 rows maximum),
page-numparameter: you can set up which page you want to retrieve. The max value for this parameter depends on
max-results(200,000 rows maximum).
- You can use up to 6 different segments in a request (including the segment used in metrics)
You'll need to ensure that the API Key you're using exists, and that it has been created on an account that has the necessary access rights to execute the API call in question.
An API Key inherits the access rights of the account on which it was created. If the account in question doesn't have access to the site you're trying to query, the API Key used won't allow you to get a result. You'll either have to create an API Key on another account, or update the account's access rights.
The space (or site)
If you copy and paste the examples from the API documentation without updating the parameters, or if you don't correctly copy the ID of the site to be queried, you'll get an error.
You'll need to ensure that the site ID in question is the correct one, and that it's entered in the correct format.
The API is limited in terms of concurrent calls to :
- 20 concurrent API calls per organization
- 5 concurrent API calls per user
If you encounter an error related to the number of concurrent calls, you'll need to retry your call in a few moments.
Properties and metrics
You'll also need to check that the properties and metrics contained in the call exist. To do this, go to Data Query and add the properties and/or metrics to your query, and observe the contents of the API call.
For properties, you can also find their property key in your Data Model.