{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":453,"path":"api-reference/rest-apis/actsub-api.md","title":"ActivitySubscriptions API","bundle":null,"doc_type":null,"release":"australia","body":"\n# ActivitySubscriptions API\n\nThe ActivitySubscriptions API provides endpoints to retrieve Activity entities from the Subscriptions and Activity Feed Framework.\n\nThis API requires activation of the Subscriptions and Activity Feed Framework \\(com.snc.activity\\_subscriptions\\) plugin. Activate the Customer Central \\(com.sn\\_csm\\_customer\\_central\\) plugin to seed configuration in all required tables. For more information on customer central configuration settings, see [Configure customer central](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/customer-service-management/configure-customer-central.md).\n\n**Parent Topic:**[REST API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/api-rest.md)\n\n## ActivitySubscriptions - GET /now/actsub/activities\n\nRetrieves activity records from the Subscriptions and Activity Feed Framework.\n\nNo role is required to access this endpoint, but data returned is limited by user access settings.\n\n### URL format\n\nVersioned URL: `/api/now/{api_version}/actsub/activities`\n\nDefault URL: `/api/now/actsub/activities`\n\n**Note:** Available versions are specified in the [REST API Explorer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/use-REST-API-Explorer.md). For scripted REST APIs there is additional version information on the [Scripted REST Service form](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\n### Supported request parameters\n\n<table class=\"rest_api_path_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\napi\\_version\n\n</td><td id=\"version-entry-RESTAPI\">\n\nOptional. Version of the endpoint to access. For example, `v1` or `v2`. Only specify this value to use an endpoint version other than the latest. Data type: String\n\n</td></tr></tbody>\n</table><table class=\"rest_api_query_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nbefore\n\n</td><td>\n\nDate/time value. The request returns only records created prior to this date and time.Data type: String\n\nFormat: YYYY-MM-DD hh:mm:ss or YYYY-MM-DD\n\n</td></tr><tr><td>\n\ncontext\n\n</td><td>\n\nRequired. Sys\\_id of an activity context.Predefined activity contexts include Consumer and Contact.\n\nData type: String\n\nTable: Activity Context \\[sn\\_actsub\\_activity\\_context\\]\n\n</td></tr><tr><td>\n\ncontext\\_instance\n\n</td><td>\n\nRequired. Sys\\_id of an instance of the specified activity context, representing the initiator of the activities you want to retrieve. Located in the appropriate table for the activity context.As an example, if you set **context** to the sys\\_id of the Consumer activity context, set this parameter to the sys\\_id of the Consumer \\[csm\\_consumer\\] table record for the consumer whose activities you want to retrieve.\n\nData type: String\n\n</td></tr><tr><td>\n\nend\\_date\n\n</td><td id=\"end-date-query-param-entry\">\n\nDate/time value. The request returns only records created during the time period defined by **start\\_date** and this parameter. Must be set along with **start\\_date**.Data type: String\n\n Format: YYYY-MM-DD hh:mm:ss or YYYY-MM-DD\n\n</td></tr><tr><td>\n\nfacets\n\n</td><td>\n\nComma-separated list of sys\\_ids of activity facet types to retrieve for the specified activity context.For more details on activity facets, see [Create facets for activity contexts](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/customer-service-management/create-facet-customer-central.md).\n\nData type: String\n\nDefault: Return all activity facet types configured for the activity context.\n\nTable: Activity Facet \\[sn\\_actsub\\_facet\\]\n\n</td></tr><tr><td>\n\nlast\n\n</td><td>\n\nIndex value of the first result row omitted from the response body. The result row index starts at 0, so the last row included in the response body is the one with the index **last**-1.For example, setting `last=5` omits rows with index 5 and above and returns at most only the first five result rows \\(with index values 0 through 4\\). Setting `stFrom=1` and `last=5` skips the first result row and returns the second through fifth result rows \\(with index values 1 through 4\\).\n\nData type: Number \\(integer\\)\n\nDefault: The value of the **com.snc.actsub.activities.api.fetch.limit** system property \\(10 by default\\).\n\n</td></tr><tr><td>\n\nrecord\\_id\n\n</td><td>\n\nSys\\_id of a record to use when rendering dynamic facets. Located in the appropriate table for the activity type you want to retrieve.For example, if you want to fetch activities for a Case record, set this parameter to the sys\\_id of the Case record in question.\n\nFor more details on dynamic facets, see [Create facets for activity contexts](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/customer-service-management/create-facet-customer-central.md).\n\nData type: String\n\n</td></tr><tr><td>\n\nstart\\_date\n\n</td><td id=\"start-date-query-param-entry\">\n\nDate/time value. The request returns only records created during the time period defined by this parameter and **end\\_date**. Must be set along with **end\\_date**.Data type: String\n\n Format: YYYY-MM-DD hh:mm:ss or YYYY-MM-DD\n\n</td></tr><tr><td>\n\nstFrom\n\n</td><td>\n\nIndex value of the first result row to include in the response body. The result row index starts at 0.For example, `stFrom=2` skips the first two result rows and returns results from the third row onward.\n\nData type: Number \\(integer\\)\n\nDefault: 0\n\n</td></tr></tbody>\n</table>|Name|Description|\n|----|-----------|\n|None| |\n\n### Headers\n\nThe following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see [Supported REST API headers](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table class=\"rest_api_request_headers\"><thead><tr><th>\n\nHeader\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAccept\n\n</td><td id=\"accept-entry-RESTAPI\">\n\nData format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr></tbody>\n</table>|Header|Description|\n|------|-----------|\n|None| |\n\n### Status codes\n\nThe following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see [REST API HTTP response codes](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table><thead><tr><th>\n\nStatus code\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n200\n\n</td><td id=\"entry-200-status-code\">\n\nSuccessful. The request was successfully processed.\n\n</td></tr><tr><td>\n\n400\n\n</td><td id=\"entry-400-status-code\">\n\nBad Request. A bad request type or malformed request was detected. The response body **result.message** parameter describes the nature of the error.Example error messages:\n\n-   `Make sure a valid context and context_instance are passed` or `Make sure a valid stream and user are passed` indicates that the request lacks one or both of the **context** and **context\\_instance** query parameters. These parameters are required.\n-   `stFrom can not be greater than last` indicates that the **stFrom** query parameter value exceeds the **last** query parameter value.\n-   `Please provide start_date and end_date` indicates that the request includes only one of the **start\\_date** and **end\\_date** query parameters, which cannot be used separately.\n-   `start_date can not be ahead of end_date` indicates that the specified **start\\_date** query parameter value occurs after the specified **end\\_date** query parameter value.\n-   `Provided context is not configured in the system` indicates that the **context** query parameter value does not represent a valid activity context.\n-   `Make sure a valid context_instance is passed` indicates that the **context\\_instance** query parameter value does not represent a valid instance of the specified activity context.\n\n</td></tr><tr><td>\n\n401\n\n</td><td id=\"entry-401-status-code\">\n\nUnauthorized. The user credentials are incorrect or have not been passed.\n\n</td></tr><tr><td>\n\n500\n\n</td><td id=\"entry-500-status-code\">\n\nInternal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.\n\n</td></tr></tbody>\n</table>### Response body parameters \\(JSON or XML\\)\n\n<table><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nresult\n\n</td><td>\n\nResult object.Data type: Object\n\n```\n\n\"result\": {\n  \"activities\": [Array],\n  \"message\": \"String\",\n  \"status\": Number,\n  \"stream\": \"String\",\n  \"user\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nresult.activities\n\n</td><td>\n\nArray of objects in which each object represents an activity record from the specified activity context and context instance.Data type: Array of Objects\n\n```\n\"activities\": [\n  {\n    \"activity_type_id\": \"String\",\n    \"content_fields\": [Array],\n    \"created\": \"String\",\n    \"icon\": \"String\",\n    \"source_table_name\": \"String\",\n    \"subheader_fields\": [Array],\n    \"subobject_sys_id\": \"String\",\n    \"subobject_table_name\": \"String\",\n    \"sys_id\": \"String\",\n    \"title\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\nresult.activities.activity\\_type\\_id\n\n</td><td>\n\nSys\\_id of the record from the Activity Types \\[sn\\_actsub\\_activity\\_type\\] table that corresponds to the type of this activity record.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.content\\_fields\n\n</td><td>\n\nArray of objects in which each object represents a field to display as content in the tile for the activity record.Data type: Array of Objects\n\n```\n\"content_fields\": [\n  {\n    \"deeplink_to_subobject\": \"String\",\n    \"display_as_timeago\": \"String\",\n    \"label\": \"String\",\n    \"show_label\": \"String\",\n    \"type\": \"String\",\n    \"value\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\nresult.activities.content\\_fields.deeplink\\_to\\_subobject\n\n</td><td>\n\nFlag indicating whether or not the content field displays as a hyperlink to the record for the object on which this activity was performed.Valid values:\n\n-   true: The content field displays as a hyperlink to the record for the object on which this activity was performed.\n-   false: The content field displays as a hyperlink to the record for the object on which this activity was performed.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.activities.content\\_fields.display\\_as\\_timeago\n\n</td><td>\n\nFlag indicating whether or not the content field displays in time ago format.Valid values:\n\n-   true: The content field displays in time ago format.\n-   false: The content field does not display in time ago format.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.activities.content\\_fields.label\n\n</td><td>\n\nLabel for the content field.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.content\\_fields.show\\_label\n\n</td><td>\n\nFlag indicating whether or not the content field label displays for content field values in the tile for this activity record.Valid values:\n\n-   true: The content field label displays for content field values in the tile for this activity record.\n-   false: The content field label doesn't display for content field values in the tile for this activity record.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.activities.content\\_fields.type\n\n</td><td>\n\nType of the content field.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.content\\_fields.value\n\n</td><td>\n\nValue of the content field.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.created\n\n</td><td>\n\nCreation date/time for this activity record.Data type: String\n\nFormat: YYYY-DD-MM hh:mm:ss\n\n</td></tr><tr><td>\n\nresult.activities.icon\n\n</td><td>\n\nName of the icon displayed on the tile for this activity record.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.source\\_table\\_name\n\n</td><td>\n\nName of the table in which this activity record is located. Determined by the Activity Source defined in the Activity Types \\[sn\\_actsub\\_activity\\_type\\] table for the type associated with this activity record.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.activities.subheader\\_fields\n\n</td><td>\n\nArray of objects in which each object represents a field displayed in the subheader of the tile for this activity record.Data type: Array of Objects\n\n```\n\"subheader_fields\": [\n  {\n    \"deeplink_to_subobject\": \"String\",\n    \"display_as_timeago\": \"String\",\n    \"label\": \"String\",\n    \"show_label\": \"String\",\n    \"type\": \"String\",\n    \"value\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\nresult.activities.subheader\\_fields.deeplink\\_to\\_subobject\n\n</td><td>\n\nFlag indicating whether or not the subheader field displays as a hyperlink to the record for the object on which this activity was performed.Valid values:\n\n-   true: The subheader field displays as a hyperlink to the record for the object on which this activity was performed.\n-   false: The subheader field doesn't display as a hyperlink to the record for the object on which this activity was performed.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.activities.subheader\\_fields.display\\_as\\_timeago\n\n</td><td>\n\nFlag indicating whether or not the subheader field displays in time ago format.Valid values:\n\n-   true: The subheader field displays in time ago format.\n-   false: The subheader field doesn't display in time ago format.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.activities.subheader\\_fields.label\n\n</td><td>\n\nLabel for the subheader field.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.subheader\\_fields.show\\_label\n\n</td><td>\n\nFlag indicating whether or not the subheader field label displays for subheader field values in the tile for this activity record.Valid values:\n\n-   true: The subheader field label displays for subheader field values in the tile for this activity record.\n-   false: The subheader field label doesn't display for subheader field values in the tile for this activity record.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.activities.subheader\\_fields.type\n\n</td><td>\n\nType of the subheader field.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.subheader\\_fields.value\n\n</td><td>\n\nValue of the subheader field.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.subobject\\_sys\\_id\n\n</td><td>\n\nSys\\_id of the record for the object on which this activity was performed. Located in the table specified in the **subobject\\_table\\_name** parameter value.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.subobject\\_table\\_name\n\n</td><td>\n\nName of the table containing the record for the object on which this activity was performed. Determined by the Table Name defined in the Activity Group \\[sn\\_actsub\\_subscribable\\_object\\] table for the group containing the activity type associated with this activity record.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.activities.sys\\_id\n\n</td><td>\n\nSys\\_id of this activity record. Located in the table specified as the **source\\_table\\_name** response body parameter value.Data type: String\n\n</td></tr><tr><td>\n\nresult.activities.title\n\n</td><td>\n\nTitle that displays on the tile for this activity record.Data type: String\n\n</td></tr><tr><td>\n\nresult.hasMoreRecords\n\n</td><td>\n\nFlag indicating whether or not the list of activities in the response body is truncated by the **last** query parameter value.Valid values:\n\n-   true: The list of activities in the response body is truncated by the **last** query parameter value. Repeating the request with a higher **last** query parameter value will return additional activities for this context and context instance.\n-   false: The list of activities in the response body isn't truncated by the **last** query parameter value. No further activities are available for this context and context instance.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.message\n\n</td><td>\n\nError message describing the problem encountered during request processing.Data type: String\n\n</td></tr><tr><td>\n\nresult.status\n\n</td><td>\n\nHTTP status code returned for request.Valid values: Refer to Status Codes.\n\nData type: Number\n\n</td></tr><tr><td>\n\nresult.stream\n\n</td><td>\n\nSys\\_id specified in request **context** query parameter.Data type: String\n\nTable: Activity Context \\[sn\\_actsub\\_activity\\_context\\]\n\n</td></tr><tr><td>\n\nresult.user\n\n</td><td>\n\nSys\\_id specified in request **context\\_instance** query parameter. Located in the appropriate table for the activity context.Data type: String\n\n</td></tr></tbody>\n</table>### cURL request\n\nRequest the second and third activity records for a specific Contact, limiting to data from 2020:\n\n```\ncurl \"https://instance.servicenow.com/api/now/actsub/activities\\\n?context=4a6a035a73d30010e37d71ef64f6a714\\\n&context_instance=ddce70866f9331003b3c498f5d3ee417\\\n&stFrom=1&last=3\\\n&start_date=2020-01-01%2000:00:00&end_date=2020-12-31%2023:59:59\" \\\n--request GET \\\n--header \"Accept: application/json\" \\\n--user \"username:password\"\n```\n\nThe response body includes the two requested activity records for the specified Contact:\n\n```\n{\n  \"result\": {\n    \"hasMoreRecords\": true,\n    \"activities\": [\n      {\n        \"subobject_table_name\": \"sn_customerservice_case\",\n        \"source_table_name\": \"sn_customerservice_case\",\n        \"content_fields\": [\n          {\n            \"value\": \"Test\",\n            \"show_label\": \"false\",\n            \"type\": \"string\",\n            \"label\": \"Short description\",\n            \"display_as_timeago\": \"false\",\n            \"deeplink_to_subobject\": \"false\"\n          }\n        ],\n        \"created\": \"2020-05-29 18:42:16\",\n        \"activity_type_id\": \"baf0aace73530010e37d71ef64f6a748\",\n        \"title\": \"Lamar Wilson created case\",\n        \"subobject_sys_id\": \"1687360e8d819010f87705a074e52ac9\",\n        \"icon\": \"clipboard_outline\",\n        \"sys_id\": \"1687360e8d819010f87705a074e52ac9\",\n        \"subheader_fields\": [\n          {\n            \"value\": \"CS0001007\",\n            \"show_label\": \"false\",\n            \"type\": \"string\",\n            \"label\": \"Number\",\n            \"display_as_timeago\": \"false\",\n            \"deeplink_to_subobject\": \"true\"\n          },\n          {\n            \"value\": \"2020-05-29 18:42:16\",\n            \"show_label\": \"false\",\n            \"type\": \"glide_date_time\",\n            \"label\": \"Created\",\n            \"display_as_timeago\": \"true\",\n            \"deeplink_to_subobject\": \"false\"\n          },\n          {\n            \"value\": \"\",\n            \"show_label\": \"false\",\n            \"type\": \"reference\",\n            \"label\": \"Assigned to\",\n            \"display_as_timeago\": \"false\",\n            \"deeplink_to_subobject\": \"false\"\n          },\n          {\n            \"value\": \"Lamar Wilson\",\n            \"show_label\": \"false\",\n            \"type\": \"reference\",\n            \"label\": \"Contact\",\n            \"display_as_timeago\": \"false\",\n            \"deeplink_to_subobject\": \"false\"\n          }\n        ]\n      },\n      {\n        \"subobject_table_name\": \"kb_knowledge\",\n        \"source_table_name\": \"kb_use\",\n        \"content_fields\": [\n          {\n            \"value\": \"How to Set Up a Broadband Router\",\n            \"show_label\": \"false\",\n            \"type\": \"string\",\n            \"label\": \"Short description\",\n            \"display_as_timeago\": \"false\",\n            \"deeplink_to_subobject\": \"false\"\n          }\n        ],\n        \"created\": \"2020-05-26 10:00:00\",\n        \"activity_type_id\": \"4a8c329273d30010e37d71ef64f6a7c1\",\n        \"title\": \"Lamar Wilson viewed knowledge article\",\n        \"subobject_sys_id\": \"f855a0a89f011200550bf7b6077fcf4f\",\n        \"icon\": \"document_outline\",\n        \"sys_id\": \"b929dd5873941010e37d71ef64f6a719\",\n        \"subheader_fields\": [\n          {\n            \"value\": \"KB0000110\",\n            \"show_label\": \"false\",\n            \"type\": \"string\",\n            \"label\": \"Number\",\n            \"display_as_timeago\": \"false\",\n            \"deeplink_to_subobject\": \"true\"\n          },\n          {\n            \"value\": \"2020-05-26 10:00:00\",\n            \"show_label\": \"false\",\n            \"type\": \"glide_date_time\",\n            \"label\": \"Created\",\n            \"display_as_timeago\": \"true\",\n            \"deeplink_to_subobject\": \"false\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## ActivitySubscriptions - GET /now/actsub/facets/\\{activity\\_context\\}/\\{context\\_instance\\}\n\nRetrieves facets configured for an activity context from the Subscriptions and Activity Feed Framework. Displays activity counts and data for each facet as determined by activity type, group, and context settings.\n\nUsers must have the actsub\\_user or admin role to access this endpoint. Data returned is limited by user access settings.\n\nFor more details on activity context facets, see [Create facets for activity contexts](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/customer-service-management/create-facet-customer-central.md).\n\n### URL format\n\nVersioned URL: `/api/now/{api_version}/actsub/facets/{activity_context}/{context_instance}`\n\nDefault URL: `/api/now/actsub/facets/{activity_context}/{context_instance}`\n\n**Note:** Available versions are specified in the [REST API Explorer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/use-REST-API-Explorer.md). For scripted REST APIs there is additional version information on the [Scripted REST Service form](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\n### Supported request parameters\n\n<table class=\"rest_api_path_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nactivity\\_context\n\n</td><td>\n\nSys\\_id of an activity context.Predefined activity contexts include Consumer and Contact. Navigate to **Customer Central** &gt; **Customer Activity** &gt; **Activity Contexts** to view the full list of activity contexts defined for your instance.\n\nData type: String\n\nTable: Activity Contexts \\[sn\\_actsub\\_activity\\_context\\]\n\n</td></tr><tr><td>\n\napi\\_version\n\n</td><td id=\"version-entry-RESTAPI\">\n\nOptional. Version of the endpoint to access. For example, `v1` or `v2`. Only specify this value to use an endpoint version other than the latest. Data type: String\n\n</td></tr><tr><td>\n\ncontext\\_instance\n\n</td><td>\n\nSys\\_id of an instance of the specified activity context, representing the initiator of the activities you want to retrieve facets for.As an example, if you set **activity\\_context** to the sys\\_id of the Contact activity context, you should set this parameter to the sys\\_id of the Contact \\[customer\\_contact\\] record for the contact whose activity facets you want to retrieve.\n\nData type: String\n\nTable: In the context table specified for the activity context record in the Activity Contexts \\[sn\\_actsub\\_activity\\_context\\] table.\n\n</td></tr></tbody>\n</table><table class=\"rest_api_query_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nend\\_date\n\n</td><td id=\"end-date-query-param-entry\">\n\nDate/time value. The request returns only records created during the time period defined by **start\\_date** and this parameter. Must be set along with **start\\_date**.Data type: String\n\n Format: YYYY-MM-DD hh:mm:ss or YYYY-MM-DD\n\n</td></tr><tr><td>\n\nfacets\n\n</td><td>\n\nComma-separated list of sys\\_ids of activity facets to retrieve for the specified activity context.To see the activity facet types defined for an activity context, navigate to **Customer Central** &gt; **Customer Activity** &gt; **Activity Contexts** and examine the **Facets** related list.\n\nData type: String\n\nDefault: Return all activity facets configured for the activity context.\n\n</td></tr><tr><td>\n\nget\\_activity\\_count\n\n</td><td>\n\nFlag indicating whether or not to include activity counts for each facet in the response body.Valid values:\n\n-   true: Include facet activity counts.\n-   false: Omit facet activity counts.\n\nData type: Boolean\n\nDefault: false\n\n</td></tr><tr><td>\n\nlazy\\_load\n\n</td><td>\n\nFlag indicating whether or not to improve performance by omitting facet activity data and activity counts from the response body. This parameter takes precedence over **get\\_activity\\_count**.Valid values:\n\n-   true: Omit facet activity data and activity counts.\n-   false: Retrieve facet activity data and activity counts.\n\nData type: Boolean\n\nDefault: false\n\n</td></tr><tr><td>\n\nstart\\_date\n\n</td><td id=\"start-date-query-param-entry\">\n\nDate/time value. The request returns only records created during the time period defined by this parameter and **end\\_date**. Must be set along with **end\\_date**.Data type: String\n\n Format: YYYY-MM-DD hh:mm:ss or YYYY-MM-DD\n\n</td></tr></tbody>\n</table>|Name|Description|\n|----|-----------|\n|None| |\n\n### Headers\n\nThe following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see [Supported REST API headers](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table class=\"rest_api_request_headers\"><thead><tr><th>\n\nHeader\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAccept\n\n</td><td id=\"accept-entry-RESTAPI\">\n\nData format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr></tbody>\n</table>|Header|Description|\n|------|-----------|\n|None| |\n\n### Status codes\n\nThe following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see [REST API HTTP response codes](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table><thead><tr><th>\n\nStatus code\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n200\n\n</td><td id=\"entry-200-status-code\">\n\nSuccessful. The request was successfully processed.\n\n</td></tr><tr><td>\n\n400\n\n</td><td id=\"entry-400-status-code\">\n\nBad Request. A bad request type or malformed request was detected. The response body **result.message** parameter describes the nature of the error.Example error messages:\n\n-   `Make sure a valid activity context details are passed` indicates that the **activity\\_context** path parameter value does not represent a valid activity context, the **context\\_instance** path parameter value does not represent a valid instance of the specified activity context, or both.\n-   `Please provide start_date and end_date` indicates that the request includes only one of the **start\\_date** and **end\\_date** query parameters, which cannot be used separately.\n-   `start_date can not be ahead of end_date` indicates that the specified **start\\_date** query parameter value occurs after the specified **end\\_date** query parameter value.\n\n</td></tr><tr><td>\n\n401\n\n</td><td id=\"entry-401-status-code\">\n\nUnauthorized. The user credentials are incorrect or have not been passed.\n\n</td></tr><tr><td>\n\n500\n\n</td><td id=\"entry-500-status-code\">\n\nInternal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.\n\n</td></tr></tbody>\n</table>### Response body parameters \\(JSON or XML\\)\n\n<table><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nresult\n\n</td><td>\n\nList of activity facets.Data type: Array of Objects\n\n```\n\"result\": [\n  {\n    \"activity_count\": Number,\n    \"children\": [Array],\n    \"facets\": [Array],\n    \"icon\": \"String\",\n    \"is_dynamic\": \"String\",\n    \"message\": \"String\",\n    \"name\": \"String\",\n    \"status\": Number\n  }\n]\n```\n\n</td></tr><tr><td>\n\nresult.activity\\_count\n\n</td><td>\n\nNumber of activity records included in this facet \\(and its children, if any. Only displayed when **lazy\\_load** query parameter is false and **get\\_activity\\_count** query parameter is true.Data type: Number\n\n</td></tr><tr><td>\n\nresult.children\n\n</td><td>\n\nArray of objects in which each object represents an activity record \\(if this is a dynamic facet\\) or a child facet \\(if this is a static facet\\).Data type: Array of Objects\n\n```\n\n\"children\": [\n  {\n    \"activity_count\": Number\n    \"facet\": \"String\",\n    \"icon\": \"String\",\n    \"title\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\nresult.children.activity\\_count\n\n</td><td>\n\nNumber of activity records included in this child facet \\(and its children, if any\\). Only displayed when the **lazy\\_load** query parameter is false and the **get\\_activity\\_count** query parameter is true.Data type: Number\n\n</td></tr><tr><td>\n\nresult.children.created\n\n</td><td>\n\nCreation date/time for this activity record.Data type: String\n\nFormat: YYYY-MM-DD hh:mm:ss\n\n</td></tr><tr><td>\n\nresult.children.facet\n\n</td><td>\n\nSys\\_id of this child facet record.Data type: String\n\nTable: Activity Facet \\[sn\\_actsub\\_facet\\]\n\n</td></tr><tr><td>\n\nresult.children.icon\n\n</td><td>\n\nName of the icon associated with this child facet.Data type: String\n\n</td></tr><tr><td>\n\nresult.children.sys\\_id\n\n</td><td>\n\nSys\\_id of this activity record. Located in the appropriate table for the parent facet type.As an example, an activity record included in the Cases facet has a sys\\_id located in the Case \\[sn\\_customerservice\\_case\\] table.\n\nData type: String\n\n</td></tr><tr><td>\n\nresult.children.metadata\n\n</td><td>\n\nArray of objects in which each object includes activity record data for a facet field configured in the Activity Facet \\[sn\\_actsub\\_facet\\] table record for this facet type.Data type: Array of Objects\n\n```\n\n\"metadata\": [\n  {\n    \"key\": \"String\",\n    \"label\": \"String\",\n    \"type\": \"String\",\n    \"value\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\nresult.children.metadata.key\n\n</td><td>\n\nName of this facet field.Data type: String\n\n</td></tr><tr><td>\n\nresult.children.metadata.label\n\n</td><td>\n\nLabel of this facet field.Data type: String\n\n</td></tr><tr><td>\n\nresult.children.metadata.type\n\n</td><td>\n\nType of this facet field.Data type: String\n\n</td></tr><tr><td>\n\nresult.children.metadata.value\n\n</td><td>\n\nValue of this facet field.Data type: String\n\n</td></tr><tr><td>\n\nresult.children.title\n\n</td><td>\n\nName of this activity record or child facet.Data type: String\n\n</td></tr><tr><td>\n\nresult.facets\n\n</td><td>\n\nList of sys\\_ids associated with this facet record. For a dynamic facet, this array contains the sys\\_id of the facet itself. For a static facet, it instead contains the sys\\_ids of all facets which are children of the facet.Data type: Array\n\n```\n\n\"facets\": [\n  \"510d7e2e73570010e37d71ef64f6a70d\",\n  \"bc9bfaaa73570010e37d71ef64f6a771\"\n]\n```\n\nTable: Activity Facet \\[sn\\_actsub\\_facet\\]\n\n</td></tr><tr><td>\n\nresult.icon\n\n</td><td>\n\nName of the icon associated with this facet.Data type: String\n\n</td></tr><tr><td>\n\nresult.is\\_dynamic\n\n</td><td>\n\nFlag indicating whether or not this facet is a dynamic facet. This value determines the type of information included in the **children** response body parameter.Possible values:\n\n-   true: This is a dynamic facet. The **children** response body parameter value contains activity record details, and the **facets** parameter contains the dynamic facet sys\\_id.\n-   false: This is a static facet \\(a facet group\\). The **children** response body parameter value contains child facets, and the **facets** parameter contains the sys\\_ids of these child facets.\n\nData type: Boolean\n\n</td></tr><tr><td>\n\nresult.message\n\n</td><td>\n\nError message describing problem encountered during request processing.Data type: String\n\n</td></tr><tr><td>\n\nresult.name\n\n</td><td>\n\nName of the facet or facet group.Data type: String\n\n</td></tr><tr><td>\n\nresult.status\n\n</td><td>\n\nHTTP status code returned for request.Possible values: See the Status Code table.\n\nData type: Number\n\n</td></tr></tbody>\n</table>### cURL request\n\nRetrieve Chat, Phone, and Knowledge articles facets and activity counts for a Contact:\n\n```\ncurl \"https://instance.servicenow.com/api/now/actsub/facets/4a6a035a73d30010e37d71ef64f6a714/ddce70866f9331003b3c498f5d3ee417\\\n?get_activity_count=true\\\n&facets=510d7e2e73570010e37d71ef64f6a70d,bc9bfaaa73570010e37d71ef64f6a771,c72d7e2e73570010e37d71ef64f6a7b8\" \\\n--request GET \\\n--header \"Accept: application/json\" \\\n--user \"username:password\"\n```\n\nThe response body includes the three requested facets as children of their facet groups, with activity counts displayed:\n\n```\n{\n  \"result\": [\n    {\n      \"is_dynamic\": false,\n      \"name\": \"Interactions\",\n      \"activity_count\": 4.0,\n      \"facets\": [\n        \"510d7e2e73570010e37d71ef64f6a70d\",\n        \"bc9bfaaa73570010e37d71ef64f6a771\"\n      ],\n      \"children\": [\n        {\n          \"facet\": \"510d7e2e73570010e37d71ef64f6a70d\",\n          \"icon\": \"chat_outline\",\n          \"activity_count\": 2.0,\n          \"title\": \"Chat\"\n        },\n        {\n          \"facet\": \"bc9bfaaa73570010e37d71ef64f6a771\",\n          \"icon\": \"phone_outline\",\n          \"activity_count\": 2.0,\n          \"title\": \"Phone\"\n        }\n      ]\n    },\n    {\n      \"is_dynamic\": false,\n      \"name\": \"Portal Activity\",\n      \"activity_count\": 5.0,\n      \"facets\": [\n        \"c72d7e2e73570010e37d71ef64f6a7b8\"\n      ],\n      \"children\": [\n        {\n          \"facet\": \"c72d7e2e73570010e37d71ef64f6a7b8\",\n          \"icon\": \"document_outline\",\n          \"activity_count\": 5.0,\n          \"title\": \"Knowledge articles\"\n        }\n      ]\n    }\n  ]\n}\n```\n\n"}}