You can use this API request to get analytics data from AnalyticsProvider.
/services/v2/analytics/advanced.json
Permissions & Notes:
You must have the View analytics permission under the Site Administration Roles in the Advanced Editor.
If you use both the fromDate and toDate parameters, the request will be for all information between those dates.
We added this request in version 1.6.3.
You can use the following parameters in your retrieve AnalyticsProvider data request:
Analytics Common: period, rate, fromDate, toDate
Analytics Action: activity, histogram
The following table provides additional parameters you can use with a retrieve AnalyticsProvider data request:
Parameter | Description | Example | Example Explanation |
---|---|---|---|
type | The type of data analytics to show. | adv-unique | This parameter will request a list of unique visitors. |
rate | The granularity of data points. | monthly | This parameter will request a list of data by month. |
fromDate | The date from which to start showing data. | 1/1/13 | This parameter will request data from January 1st, 2013 forward. |
toDate | The date at which to stop showing data. | 1/1/14 | This parameter will request a list of data from before January 1st, 2014. |
space | The space to show analytics for. | 8 | This parameter will request analytics data for the space with a spaceId of 8. |
groups | The groupId of the group of users to show data for. | 271 | This parameter will request analytics data for the group with a groupId of 271 |
Sample Request
A GET retrieve AnalyticsProvider data request sent to https://apidocs.cloud.answerhub.com using a human-readable Username/Password (answerhub/test123) would look like this:
curl
-u answerhub:test123
-H "Accept: application/json"
-H "Content-type: application/json"
-X GET "https://apidocs.cloud.answerhub.com/services/v2/analytics/advanced.json"
Sample Response
{
"cause": {
"cause": {
"stackTrace": [
{
"methodName": "requireClassPersister",
"fileName": "SessionFactoryHelper.java",
"lineNumber": 171,
"className": "org.hibernate.hql.internal.ast.util.SessionFactoryHelper",
"nativeMethod": false
},
{
"methodName": "addFromElement",
"fileName": "FromElementFactory.java",
"lineNumber": 91,
"className": "org.hibernate.hql.internal.ast.tree.FromElementFactory",
"nativeMethod": false
},
{
"methodName": "addFromElement",
"fileName": "FromClause.java",
"lineNumber": 79,
"className": "org.hibernate.hql.internal.ast.tree.FromClause",
"nativeMethod": false
},
{
"methodName": "createFromElement",
"fileName": "HqlSqlWalker.java",
"lineNumber": 326,
"className": "org.hibernate.hql.internal.ast.HqlSqlWalker",
"nativeMethod": false
},
{
"methodName": "fromElement",
"fileName": "HqlSqlBaseWalker.java",
"lineNumber": 3696,
"className": "org.hibernate.hql.internal.antlr.HqlSqlBaseWalker",
"nativeMethod": false
},
{
"methodName": "fromElementList",
"fileName": "HqlSqlBaseWalker.java",
"lineNumber": 3585,
"className": "org.hibernate.hql.internal.antlr.HqlSqlBaseWalker",
"nativeMethod": false
},
{
"methodName": "fromClause",
"fileName": "HqlSqlBaseWalker.java",
"lineNumber": 720,
"className": "org.hibernate.hql.internal.antlr.HqlSqlBaseWalker",
"nativeMethod": false
},
... removed a portion of the response due to the length
{
"methodName": "run",
"fileName": "TaskThread.java",
"lineNumber": 61,
"className": "org.apache.tomcat.util.threads.TaskThread$WrappingRunnable",
"nativeMethod": false
},
{
"methodName": "run",
"fileName": "Thread.java",
"lineNumber": 748,
"className": "java.lang.Thread",
"nativeMethod": false
}
],
"message": "org.hibernate.hql.internal.ast.QuerySyntaxException: Adv_RequestLog is not mapped [select new map(day(log.requestDate) as dataDay, month(log.requestDate) as dataMonth, year(log.requestDate) as dataYear, count(distinct a.id) as ideaCount, log.space.id as logSpace) from Adv_RequestLog log join log.triggeredActions a where (log.requestDate >= :fromDate and log.requestDate < :toDate and a.class = NewIdeaAction and log.space in (:spaces)) group by day(log.requestDate), month(log.requestDate), year(log.requestDate), log.space order by dataMonth, dataYear, dataDay]",
"localizedMessage": "org.hibernate.hql.internal.ast.QuerySyntaxException: Adv_RequestLog is not mapped [select new map(day(log.requestDate) as dataDay, month(log.requestDate) as dataMonth, year(log.requestDate) as dataYear, count(distinct a.id) as ideaCount, log.space.id as logSpace) from Adv_RequestLog log join log.triggeredActions a where (log.requestDate >= :fromDate and log.requestDate < :toDate and a.class = NewIdeaAction and log.space in (:spaces)) group by day(log.requestDate), month(log.requestDate), year(log.requestDate), log.space order by dataMonth, dataYear, dataDay]",
"suppressed": []
}