apiusage-by-time

The following shows how to generate the apiusage-by-time report using either the Reporting API's Generate a report POST operation or the Get a cacheable report GET operation. Details about each report's supported products, metrics, filters, and available data intervals are also available dynamically by running the API's Get a report type operation, also shown below. See also other available reports.

Report definition

The API usage report allows you to audit which users are using APIs and which APIs are most frequently used.

This report allows you to configure the aggregation interval for each data record. Available interval values are: MONTH, WEEK, DAY, HOUR.

Business object: account_id

Data available for: 92 days

Required products: EDGECONTROL

Available metrics

MetricDescription
Data metrics
bytesThe bandwidth used during the request for the associated URL.
requestsRequests.
Summary metrics
bytesTotalThe total bandwidth used for requests.
requestsTotalTotal requests for a given time frame.

Available filters

FilterTypeDescription
Optional filters
af_containStringAgent family contains the specified string.
af_end_withStringAgent family ends with the specified string.
af_exact_matchStringAgent family is an exact match for the specified string.
af_matchStringAgent family matches the specified string.
af_not_containStringAgent family does not contain the specified string.
af_not_end_withStringAgent family does not end with the specified string.
af_not_matchStringAgent family does not match the specified string.
af_not_start_withStringAgent family does not start with the specified string.
af_start_withStringAgent family starts with the specified string.
contract_typeStringA contract type ID a given user has access to.
endpointStringAn API configuration registered with Akamai.
response_classEnumerationA class of HTTP response status codes, from 0xx through 6xx.
0xx: An aborted action on the client side.
1xx: An informational response, like Continue.
2xx: A successful response.
3xx: Success, but a redirect where the thing you want is somewhere else.
4xx: Error that indicates a problem with the client's request.
5xx: Error that indicates a problem with the server's response.
6xx: Invalid headers, defined by Akamai.
response_codeStringAn HTTP response status code, for example, 201.
response_statusEnumerationAn indicator of whether the HTTP response resulted in success or an error.
success: Successful HTTP response status.
error: Error HTTP response status.
usernameStringName of client generating API request.

POST request

POST /reporting-api/v1/reports/apiusage-by-time/versions/1/report-data{?start,‚Äčend,‚Äčinterval}

Sample: /reporting-api/v1/reports/apiusage-by-time/versions/1/report-data?start‚Äč=2021-07-05T10%3A00%3A00Z‚Äč&end‚Äč=2021-07-05T14%3A00%3A00Z‚Äč&interval‚Äč=HOUR

For other granularity, you need to adjust start and end dates:

Sample with longer interval: /reporting-api/v1/reports/apiusage-by-time/versions/1/report-data?start=2021-03-01&end=2021-07-01&interval=MONTH

Query parameters

ParameterTypeSampleDescription
Required
startString2021-07-05T10:00:00ZSpecifies the start of the reported period as an ISO-8601 timestamp with an optional time zone. The report includes data that matches the start value's timestamp.
endString2021-07-05T14:00:00ZSpecifies the end of the reported period as an ISO-8601 timestamp with optional time zone. The report excludes any data that matches the end value's timestamp.
intervalEnumerationHOURThe duration of each data record. Available values: MONTH, WEEK, DAY, HOUR.

JSON request members

MemberTypeDescription
objectIdsArraySpecifies unique ID for the account_id objectType you want to report on.
metricsArrayThe set of desired metrics. If omitted, the report includes all available metrics.
filtersMap of arraysSpecifies a set of custom filters, with each filter's name keying an array with each filter's set of values.

Request body:

{
    "objectIds": [
        "account1",
    ],
    "metrics": [
        "bytes",
        "bytesTotal",
        "requests",
        "requestsTotal"
    ],
    "filters": {
        "af_contain": [
            "exampletext1"
        ],
        "af_end_with": [
            "exampletext2"
        ],
        "af_exact_match": [
            "exampletext3"
        ],
        "af_match": [
            "exampletext4"
        ],
        "af_not_contain": [
            "exampletext5"
        ],
        "af_not_end_with": [
            "exampletext6"
        ],
        "af_not_match": [
            "exampletext7"
        ],
        "af_not_start_with": [
            "exampletext8"
        ],
        "af_start_with": [
            "exampletext9"
        ],
        "contract_type": [
            "1-3CV382",
        ],
        "endpoint": [
            "endpoint/1",
            "endpoint/2"
        ],
        "response_class": [
            "4xx",
            "0xx"
        ],
        "response_code": [
            "500",
            "503"
        ],
        "response_status": [
            "success",
            "error"
        ],
        "username": [
            "username1",
            "username2"
        ]
    }
}

GET request

GET /reporting-api/v1/reports/apiusage-by-time/versions/1/report-data{?start,‚Äčend,‚Äčinterval,‚ÄčobjectIds,‚Äčmetrics,‚Äčfilters}

Sample: `/reporting-api/v1/reports/apiusage-by-time/versions/1/report-data?start‚Äč=2021-07-05T10%3A00%3A00Z‚Äč&end‚Äč=2021-07-05T14%3A00%3A00Z‚Äč&interval‚Äč=HOUR‚Äč&objectIds‚Äč=account1‚Äč&metrics‚Äč=bytes%2CbytesTotal&filters=af_contain%3Dexampletext1%2Caf_contain%3Dexampletext2%2Caf_end_with%3Dexampletext3%2Caf_end_with%3Dexampletext4``

Query parameters

ParameterTypeSampleDescription
Required
startString2021-07-05T10:00:00ZSpecifies the start of the reported period as an ISO-8601 timestamp with optional time zone.
endString2021-07-05T14:00:00ZSpecifies the end of the reported period as an ISO-8601 timestamp with optional time zone. The report excludes any data that matches the end value's timestamp.
intervalEnumerationHOURThe duration of each data record. Available values: MONTH, WEEK, DAY, HOUR.
Optional
objectIdsStringaccount1Specifies unique ID for the account_id objectType you want to report on.
metricsStringbytes,‚ÄčbytesTotalSpecifies a comma-separated list of metrics to include in the report, otherwise all metrics if omitted. The set of available metrics depends on the type of report. URL-encode the entire value in the GET request.
filtersStringcontract_type=‚Äč1-3CV382,endpoint=‚Äčendpoint/1,‚Äčendpoint=‚Äčendpoint/2Specifies criteria to filter the report's data. The set of available filters depends on the type of report. Separate each filter name and value with an equals (=) character, and separate various name/value pairs with commas (,). To specify more than one filter value, repeat the filter name. See the accompanying example for guidance. URL-encode the entire value in the GET request.

JSON response

Status 200 application/json

Response body:

{
    "metadata": {
        "name": "apiusage-by-time",
        "version": "1",
        "outputType": "FLAT",
        "groupBy": [
            "startdatetime"
        ],
        "interval": "HOUR",
        "start": "2021-07-05T10:00:00Z",
        "end": "2021-07-05T14:00:00Z",
        "availableDataEnds": null,
        "suggestedRetryTime": null,
        "rowCount": 4,
        "filters": [
            {
                "name": "af_contain",
                "values": [
                    "exampletext1"
                ]
            },
            {
                "name": "af_end_with",
                "values": [
                    "exampletext2"
                ]
            },
            {
                "name": "af_exact_match",
                "values": [
                    "exampletext3"
                ]
            },
            {
                "name": "af_match",
                "values": [
                    "exampletext4"
                ]
            },
            {
                "name": "af_not_contain",
                "values": [
                    "exampletext5"
                ]
            },
            {
                "name": "af_not_end_with",
                "values": [
                    "exampletext6"
                ]
            },
            {
                "name": "af_not_match",
                "values": [
                    "exampletext7"
                ]
            },
            {
                "name": "af_not_start_with",
                "values": [
                    "exampletext8"
                ]
            },
            {
                "name": "af_start_with",
                "values": [
                    "exampletext9"
                ]
            },
           {
                "name": "contract_type",
                "values": [
                    "1-3CV382",
                ]
            },
            {
                "name": "endpoint",
                "values": [
                    "endpoint/1",
                    "endpoint/2"
                ]
            },
            {
                "name": "response_class",
                "values": [
                    "0xx",
                    "4xx"
                ]
            },
            {
                "name": "response_code",
                "values": [
                    "403",
                    "404"
                ]
            },
            {
                "name": "response_status",
                "values": [
                    "success",
                    "error"
                ]
            },
            {
                "name": "username",
                "values": [
                    "username1",
                    "username2"
                ]
            }
        ],
        "columns": [
            {
                "name": "groupBy",
                "label": "startdatetime"
            },
            {
                "name": "bytes",
                "label": "Bytes"
            },
            {
                "name": "requests",
                "label": "Requests"
            }
        ],
        "objectType": "account_id",
        "objectIds": [
            "account1",
        ]
    },
    "data": [
        {
            "startdatetime": "2021-07-05T10:00:00Z",
            "bytes": "2523",
            "requests": "1780"
        },
        {
            "startdatetime": "2021-07-05T11:00:00Z",
            "bytes": "3380",
            "requests": "3875"
        },
        {
            "startdatetime": "2021-07-05T12:00:00Z",
            "bytes": "669",
            "requests": "4001"
        },
        {
            "startdatetime": "2021-07-05T13:00:00Z",
            "bytes": "419",
            "requests": "290"
        }
    ],
    "summaryStatistics": {
        "bytesTotal": {
            "value": "2924",
            "details": {}
        },
        "requestsTotal": {
            "value": "148",
            "details": {}
        }
    }
}

CSV response

Status 200 text/csv

Response Body:

#METADATA_START
name,‚Äčapiusage-by-time
version,‚Äč1
source,‚Äčapiusage-by-time/versions/1
groupBy,‚Äčstartdatetime
start,2022-06-23T10:00:00Z
end,2022-06-23T14:00:00Z
interval,`HOUR`
availableDataEnds,
suggestedRetryTime,
rowCount,‚Äč4
objectType,‚Äčaccount_id
objectIds,account1
af_contain,exampletext1
af_end_with,exampletext2
af_exact_match,exampletext3
af_match,exampletext4
af_not_contain,exampletext5
af_not_end_with,exampletext6
af_not_match,exampletext7
af_not_start_with,exampletext8
af_start_with,exampletext9
contract_type,‚Äč1-3CV382
endpoint,‚Äčendpoint/1,‚Äčendpoint/2
response_class,‚Äč0xx,‚Äč4xx
response_code,‚Äč403,‚Äč404
response_status,‚Äčsuccess,‚Äčerror
username,‚Äčusername1,‚Äčusername2
#METADATA_END

#SUMMARYSTATISTICS_START
bytesTotal,3252
requestsTotal,2615
#SUMMARYSTATISTICS_END

#COLUMNS_START
startdatetime,bytes,requests
#COLUMNS_END

#DATA_START
2022-06-23T10:00:00Z,661,2697
2022-06-23T11:00:00Z,3126,2466
2022-06-23T12:00:00Z,1416,3455
2022-06-23T13:00:00Z,3830,3676
#DATA_END

Get report details

This sample Get a report type operation gets the same information you need to run the apiusage-by-time report as provided in this reference documentation, but available dynamically to your API client application.

GET /reporting-api/v1/reports/apiusage-by-time/versions/1

Status 200 application/json

Response body:

{
    "name": "apiusage-by-time",
    "description": "The API usage report allows users to audit which users are using APIs and which APIs are most frequently/heavily used",
    "businessObjectName": "account_id",
    "version": 1,
    "status": "PUBLISHED",
    "deprecated": false,
    "timeBased": true,
    "supportsPagination": false,
    "outputType": "FLAT",
    "requiredProducts": [
        "EDGECONTROL"
    ],
    "requiredRoles": [
        "IDM: API Clients - Admin Access"
    ],
    "available": true,
    "metrics": [
        {
            "name": "bytes",
            "description": "The bandwidth used during the request for the associated URL.",
            "label": "Bytes",
            "unit": "BYTE",
            "summaryStatistic": false
        },
        {
            "name": "bytesTotal",
            "description": "The total bandwidth used for requests.",
            "label": "Total Bytes",
            "unit": "BYTE",
            "summaryStatistic": true
        },
        {
            "name": "requests",
            "description": "Requests.",
            "label": "Requests",
            "unit": "COUNT",
            "summaryStatistic": false
        },
        {
            "name": "requestsTotal",
            "description": "Total requests for a given time frame.",
            "label": "Total Requests",
            "unit": "COUNT",
            "summaryStatistic": true
        }
    ],
    "groupOutlyingValues": {
        "enabled": false
    },
    "groupBy": [
        "startdatetime"
    ],
    "filters": [
        {
            "name": "endpoint",
            "type": "string",
            "description": "An API configuration registered with Akamai.",
            "required": false
        },
        {
            "name": "http_method",
            "type": "enum",
            "description": "A request method indicating the action performed on a resource.",
            "values": [
                {
                    "value": "head",
                    "description": "Retrieves header information about the target resource, with no message body in the response."
                },
                {
                    "value": "other",
                    "description": "Other"
                },
                {
                    "value": "post",
                    "description": "Sends information to the server."
                },
                {
                    "value": "get",
                    "description": "Retrieves information about the target resource."
                },
                {
                    "value": "delete",
                    "description": "Removes all information about the target resource."
                },
                {
                    "value": "put",
                    "description": "Replaces existing information about the target resource."
                }
            ],
            "required": false
        },
        {
            "name": "contract_type",
            "type": "string",
            "description": "A contract type ID a given user has access to.",
            "required": false
        },
        {
            "name": "af_not_match",
            "type": "string",
            "description": "Agent family does not match the specified string.",
            "required": false
        },
        {
            "name": "af_match",
            "type": "string",
            "description": "Agent family matches the specified string.",
            "required": false
        },
        {
            "name": "af_not_start_with",
            "type": "string",
            "description": "Agent family does not start with the specified string.",
            "required": false
        },
        {
            "name": "af_start_with",
            "type": "string",
            "description": "Agent family starts with the specified string.",
            "required": false
        },
        {
            "name": "response_status",
            "type": "enum",
            "description": "An indicator of whether the HTTP response resulted in success or an error.",
            "values": [
                {
                    "value": "success",
                    "description": "Successful HTTP response status."
                },
                {
                    "value": "error",
                    "description": "Error HTTP response status."
                }
            ],
            "required": false
        },
        {
            "name": "af_exact_match",
            "type": "string",
            "description": "Agent family is an exact match for the specified string.",
            "required": false
        },
        {
            "name": "username",
            "type": "string",
            "description": "Name of client generating API request.",
            "required": false
        },
        {
            "name": "af_not_end_with",
            "type": "string",
            "description": "Agent family does not end with the specified string.",
            "required": false
        },
        {
            "name": "af_end_with",
            "type": "string",
            "description": "Agent family ends with the specified string.",
            "required": false
        },
        {
            "name": "response_code",
            "type": "string",
            "description": "An HTTP response status code, for example, 201.",
            "required": false
        },
        {
            "name": "response_class",
            "type": "enum",
            "description": "A class of HTTP response status codes, from 0xx through 6xx.",
            "values": [
                {
                    "value": "0xx",
                    "description": "An aborted action on the client side."
                },
                {
                    "value": "1xx",
                    "description": "An informational response, like Continue."
                },
                {
                    "value": "2xx",
                    "description": "A successful response. "
                },
                {
                    "value": "3xx",
                    "description": "Success, but a redirect where the thing you want is somewhere else."
                },
                {
                    "value": "4xx",
                    "description": "Error, where there’s some problem with the client request."
                },
                {
                    "value": "5xx",
                    "description": "Error, where there’s some problem with how the API server responded to the client request."
                },
                {
                    "value": "6xx",
                    "description": "Invalid headers (defined by Akamai)."
                }
            ],
            "required": false
        },
        {
            "name": "af_not_contain",
            "type": "string",
            "description": "Agent family does not contain the specified string.Y",
            "required": false
        },
        {
            "name": "af_contain",
            "type": "string",
            "description": "Agent family contains the specified string.",
            "required": false
        }
    ],
    "intervals": [
        "MONTH",
        "WEEK",
        "DAY",
        "HOUR"
    ],
    "dataRetentionDays": 92,
    "links": [
        {
            "rel": "self",
            "href": "/reporting-api/v1/reports/apiusage-by-time/versions/1"
        },
        {
            "rel": "versions",
            "href": "/reporting-api/v1/reports/apiusage-by-time/versions"
        },
        {
            "rel": "all-reports",
            "href": "/reporting-api/v1/reports"
        },
        {
            "rel": "execute-report",
            "href": "/reporting-api/v1/reports/apiusage-by-time/versions/1/report-data"
        }
    ]
}