REST & SOAP API analytics collection and cleanup

API analytics uses scheduled jobs to collect and clean up analytics data.

The instance tracks all web service transactions for whitelisted APIs and maintains a daily history, aggregated by resource and HTTP action combination. Requester information is aggregated per requester, resource, and HTTP action combination and tracked up to the daily limit defined by the property com.glide.api.stats.daily_ limit.

Refer to the following table to determine which requests are logged.
Table 1. Logged requests
Whitelist API name Example resource Response code Description Logged
now/table /api/now/table/incident Any except 401 Valid resource and table Yes
now/table /api/now/table/invalidResource 400 Valid resource but an invalid table Yes
now/table /api/now/table/incident 403 Requesting user has insufficient privileges Yes
now/table /api/now/table/incident 401 Requesting user is not authenticated No
myApp/myScriptedApi myApp/myScriptedApi/myResource Any except 401 Valid resource Yes
  • myApp/invalidApiName
  • myApp/invalidApiName/myResource
400 Invalid API, even with a matching whitelist entry No

On the 2nd of each month, the API Monthly Stats scheduled job calculates the monthly total for each resource and HTTP action combination. Each day the API Monthly Requestor Stats scheduled job calculates the monthly total for each resource, requester, and HTTP action combination based on daily scores older than 2 days.

Daily statistics are maintained for 33 days. Monthly totals are maintained for 13 months. Table cleaners for the sys_api_stats, sys_api_stats_requestor, and sys_api_stats_requestor_monthly tables remove analytics records older than these limits.

REST & SOAP API analytics naming

The API Name used when tracking API analytics is determined by the type of API being described, such as a REST API or a Scripted SOAP service.

API type Description
REST The API namespace and the first part of the URI following the namespace is used as the API name.

For example, for the Table API endpoints api/now/table/incident and api/now/table/problem, the namespace and ID are now/table.

Direct SOAP (table does not extend Import Set Row table) If the direct SOAP request accesses a table, Direct SOAP is used as the API name.
SOAP import (table extends Import Set Row table) Import Set SOAP is used as the API name.
Scripted SOAP Services The SOAP request endpoint page is used as the API name, such as