Querying for activities
Activities cannot exist on their own. They must be attached to a parent object. In PolicyCenter, activities can be attached to accounts, jobs, or policies.
You can use the following endpoints to GET activities.
Endpoint | Returns |
---|---|
/common/v1/activities |
All activities |
/common/v1/activities/{activityId} |
The activity with the given ID |
/account/v1/accounts/{accountId}/activities |
All activities associated with the given account |
/job/v1/jobs/{jobId}/activities |
All activities associated with the given job |
/policy/v1/policies/{policyId}/activities |
All activities associated with the given policy |
Note that the endpoints to retrieve activities exist in different APIs. To get all activities for an account, job, or policy, you use endpoints in the Account API, Job API, or Policy API. But to get information about all activities (regardless of parent), or to get information about a specific activity, you use endpoints in the Common API.
For example, the following query retrieves the IDs and subjects of all activities for account pc:101. This endpoint is in the Account API.
Request
GET account/v1/accounts/pc:101/activities?fields=id,subject
Response
{
"count": 2,
"data": [
{
"attributes": {
"id": "pc:23221",
"subject": "All ordered MVRs received - Clear"
}
},
{
"attributes": {
"id": "pc:40404",
"subject": "Review Risk Information"
}
}
],
...
The following query retrieves activity pc:40404 in detail. This endpoint is in the Common API.
Request
GET /common/v1/activities/pc:40404
Response
{
"data": {
"attributes": {
"activityType": {
"code": "general",
"name": "General"
},
"assignedGroup": {
"displayName": "Los Angeles Branch UW",
"id": "pc:SPMK8WfF0qE3G7erNndfW"
},
"assignedUser": {
"displayName": "Alice Applegate",
"id": "pc:SSmfb1spW-C2IyI8rFOja",
"type": "User",
"uri": "/admin/v1/users/pc:SSmfb1spW-C2IyI8rFOja"
},
"assignmentStatus": {
"code": "assigned",
"name": "Assigned"
},
"createTime": "2023-11-26T08:02:56.607Z",
"description": "Review the risk information for the policy's scheduled items.",
"dueDate": "2023-11-26T08:02:56.604Z",
"escalated": false,
"externallyOwned": false,
"id": "pc:40404",
"mandatory": false,
"priority": {
"code": "normal",
"name": "Normal"
},
"recurring": false,
"status": {
"code": "open",
"name": "Open"
},
"subject": "Review Risk Information"
},
...