You can use this API request to retrieve analytics related to users' content-related activities on the AnswerHub platform.
/services/v2/analytics/content.json
Permissions & Notes:
You must have the View analytics permission under 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 content activity request:
Analytics Common: period, rate, fromDate, toDate
Analytics Action: activity, histogram
We consider the following action types, content activities, for the purpose of this request:
Action | Verb (Type Name) | Description |
---|---|---|
AskAction | ask | A user asked a new question. |
AnswerAction | answer | A user has posted a new answer to a question. |
CommentAction | commented | A user has posted a new comment on a node. |
AcceptNodeAction | accepted | A node sent for moderation has been accepted for publishing. |
DeleteAction | deleted | A node has been deleted. |
CloseNodeAction | closed | A question has been closed. |
Sample Requests
cURL Example 1:
A GET retrieve content activity analytics request sent to
https://apidocs.cloud.answerhub.com with a date range from 1/14/19 to 1/15/19 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/content.json?fromDate=1/14/19&toDate=1/15/19"
cURL Example 2:
A GET retrieve content activity analytics request sent to
https://apidocs.cloud.answerhub.com with a date range from 1/30/19 to 2/15/19 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/content.json?fromDate=1/30/19&toDate=2/15/19
Sample Responses
Successful Response:
- HTTP Status 200 - OK
{
"actionsAnalytics": {
"actions": [
{
"type": "AskAction",
"verb": "Questions Asked",
"count": 8
},
{
"type": "AnswerAction",
"verb": "Answers To Questions",
"count": 7
},
{
"type": "CommentAction",
"verb": "Comments Made",
"count": 12
},
{
"type": "AcceptNodeAction",
"verb": "Answers Accepted",
"count": 2
},
{
"type": "DeleteAction",
"verb": "Content Deleted",
"count": 6
},
{
"type": "CloseNodeAction",
"verb": "Questions Closed",
"count": 9
}
]
}
}
{
"actionsAnalytics": {
"actions": [
{
"type": "AskAction",
"verb": "Questions Asked",
"count": 7
},
{
"type": "AnswerAction",
"verb": "Answers To Questions",
"count": 2
},
{
"type": "CommentAction",
"verb": "Comments Made",
"count": 7
},
{
"type": "AcceptNodeAction",
"verb": "Answers Accepted",
"count": 1
},
{
"type": "DeleteAction",
"verb": "Content Deleted",
"count": 6
},
{
"type": "CloseNodeAction",
"verb": "Questions Closed",
"count": 9
}
]
}
}