hits-by-cpcode

The following shows how to generate the hits-by-cpcode 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

Provides hits data by CP code.

If you use China CDN and want to monitor the offload metrics, use the new delivery/traffic/current report in the API v2.

Business object: cpcode

Data available for: 92 days

Available metrics

MetricDescription
Data metrics
edgeHitsThe request count delivered from Akamai edge servers to the end user.
hitsOffloadThe number of hits that Akamai served as a percentage of total hits served for given objects and filters.
originHitsThe number of requests delivered from the origin.

Available filters

FilterTypeDescription
Optional filters
delivery_typeEnumerationDistinguishes secure from non-secure traffic.
secure: Secure traffic.
non_secure: Non-secure traffic.
http_versionEnumerationHTTP version.
https1.1: https1.1
http2: http2
http3: http3
http1.1: http1.1
ip_versionEnumerationThe IP for which the report is shown.
ipv4: IP address in v4 format.
ipv6: IP address in v6 format.
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, where there's some problem with the client request.
5xx: Error, where there's some problem with how the API server responded to the client request.
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.
trafficEnumerationHTTP traffic to be included in the report data.
get_head_responses: Response header traffic from GET operations.
put_post_requests: Request traffic from PUT and POST operations.
all_responses: All response traffic.
put_post_responses: Response traffic from PUT and POST operations.

POST request

POST /reporting-api/v1/reports/hits-by-cpcode/versions/1/report-data{?start,​end}

Sample: /reporting-api/v1/reports/hits-by-cpcode/versions/1/report-data?start​=2019-09-01T00%3A00%3A00Z​&end​=2019-10-01T00%3A00%3A00Z

Query parameters

ParameterTypeSampleDescription
Required
startString2019-09-01T00: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.
endString2019-10-01T00:00:00ZSpecifies if unavailable reports should be shown.

JSON request members

MemberTypeDescription
objectIdsArraySpecifies the set of cpcode values you want to report on.
objectIdsEnumerationAs an alternative to an array of ID values, specify all as a string for unfiltered data. Either way, objectIds is required.
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": [
        "55232",
        "23433",
        "32433"
    ],
    "metrics": [
        "edgeHits",
        "hitsOffload",
        "originHits"
    ],
    "filters": {
        "delivery_type": [
            "secure",
            "non-secure"
        ],
        "http_version": [
            "https1.1",
            "http2"
        ],
        "ip_version": [
            "ipv4",
            "ipv6"
        ],
        "response_class": [
            "5xx",
            "3xx"
        ],
        "response_code": [
            "201",
            "100"
        ],
        "response_status": [
            "success",
            "error"
        ],
        "traffic": [
            "put_post_responses",
            "get_head_responses"
        ]
    }
}

GET request

GET /reporting-api/v1/reports/hits-by-cpcode/versions/1/report-data{?start,​end,​objectIds,​allObjectIds,​metrics,​filters}

Sample: /reporting-api/v1/reports/hits-by-cpcode/versions/1/report-data?start​=2019-09-01T00%3A00%3A00Z​&end​=2019-10-01T00%3A00%3A00Z​&objectIds​=55232,​23433,​32433​&metrics​=edgeHits%2ChitsOffload​&filters​=delivery_type%3Dsecure%2Cdelivery_type%3Dnon-secure%2Cip_version%3Dipv4%2Cip_version%3Dipv6

Query parameters

ParameterTypeSampleDescription
Required
startString2022-06-23T13:55:00ZSpecifies the start of the reported period as an ISO-8601 timestamp with optional time zone. The report includes data that matches the start value’s timestamp.
endString2022-06-23T14:15: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.
Optional
allObjectIdsBooleantrueAs an alternative to objectIds, enabling this generates a report that includes all IDs available for the cpcode objectType. This parameter is ignored if the request also specifies a set of objectIds.
objectIdsString55232,​23433,​32433As an alternative to allObjectIds, specifies the set of unique IDs for the cpcode objectType you want to report on, formatted as a comma-delimited list.
metricsStringedgeHits,​hitsOffloadSpecifies 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.
filtersStringdelivery_type=​secure,​delivery_type=​non-secure,​ip_version=​ipv4,​ip_version=​ipv6Specifies 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": "hits-by-cpcode",
        "version": "1",
        "outputType": "FLAT",
        "groupBy": [
            "cpcode"
        ],
        "start": "2022-05-01T00:00:00Z",
        "end": "2022-06-01T00:00:00Z",
        "availableDataEnds": null,
        "suggestedRetryTime": null,
        "rowCount": 4,
        "filters": [
            {
                "name": "ca",
                "values": [
                    "cacheable",
                    "non_cacheable"
                ]
            },
            {
                "name": "delivery_type",
                "values": [
                    "secure",
                    "non-secure"
                ]
            },
            {
                "name": "http_version",
                "values": [
                    "https1.1",
                    "http2"
                ]
            },
            {
                "name": "ip_version",
                "values": [
                    "ipv4",
                    "ipv6"
                ]
            },
            {
                "name": "response_class",
                "values": [
                    "1xx",
                    "2xx"
                ]
            },
            {
                "name": "response_code",
                "values": [
                    "404",
                    "201"
                ]
            },
            {
                "name": "response_status",
                "values": [
                    "success",
                    "error"
                ]
            },
            {
                "name": "traffic",
                "values": [
                    "get_head_responses",
                    "put_post_requests"
                ]
            }
        ],
        "columns": [
            {
                "name": "groupBy",
                "label": "cpcode"
            },
            {
                "name": "edgeHits",
                "label": "Edge Hits"
            },
            {
                "name": "hitsOffload",
                "label": "Offloaded Hits"
            },
            {
                "name": "originHits",
                "label": "Origin Hits"
            }
        ],
        "objectType": "cpcode",
        "objectIds": [
            "55232",
            "23433",
            "32433"
        ]
    },
    "data": [
        {
            "cpcode": "12345",
            "edgeHits": "732",
            "hitsOffload": "32",
            "originHits": "2515"
        },
        {
            "cpcode": "45123",
            "edgeHits": "2399",
            "hitsOffload": "67",
            "originHits": "3005"
        },
        {
            "cpcode": "34512",
            "edgeHits": "17",
            "hitsOffload": "61",
            "originHits": "166"
        },
        {
            "cpcode": "51234",
            "edgeHits": "3938",
            "hitsOffload": "63",
            "originHits": "3334"
        }
    ],
    "summaryStatistics": {}
}

CSV response

Status 200 text/csv

Response Body:

#METADATA_START
name,hits-by-cpcode
version,1
source,hits-by-cpcode/versions/1
groupBy,cpcode
start,2022-05-01T00:00:00Z
end,2022-06-01T00:00:00Z
availableDataEnds,
suggestedRetryTime,
rowCount,4
objectType,cpcode
objectIds,55232,23433,32433
ca,cacheable,non_cacheable
delivery_type,secure,non-secure
http_version,https1.1,http2
ip_version,ipv4,ipv6
response_class,1xx,2xx
response_code,404,201
response_status,success,error
traffic,get_head_responses,put_post_requests
#METADATA_END

#SUMMARYSTATISTICS_START

#SUMMARYSTATISTICS_END

#COLUMNS_START
cpcode,edgeHits,hitsOffload,originHits
#COLUMNS_END

#DATA_START
12345,732,32,2515
45123,2399,67,3005
34512,17,61,166
51234,3938,63,3334
#DATA_END

Get report details

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

GET /reporting-api/v1/reports/hits-by-cpcode/versions/1

Status 200 application/json

Response body:

{
    "name": "hits-by-cpcode",
    "description": "Provides hits data by CP code.",
    "businessObjectName": "cpcode",
    "version": 1,
    "status": "PUBLISHED",
    "deprecated": false,
    "timeBased": false,
    "supportsPagination": false,
    "outputType": "FLAT",
    "requiredProducts": [
        "Basic Traffic Reports"
    ],
    "requiredRoles": [
        "Reports - All privileges",
        "Reports - View only",
        "OTA App User"
    ],
    "available": true,
    "metrics": [
        {
            "name": "edgeHits",
            "description": "The request count delivered from Akamai edge servers to the end user.",
            "label": "Edge Hits",
            "unit": "COUNT",
            "summaryStatistic": false
        },
        {
            "name": "hitsOffload",
            "description": "The number of hits that Akamai served as a percentage of total hits served for given objects and filters.",
            "label": "Offloaded Hits",
            "unit": "RATIO",
            "summaryStatistic": false
        },
        {
            "name": "originHits",
            "description": "The number of requests delivered from the origin.",
            "label": "Origin Hits",
            "unit": "COUNT",
            "summaryStatistic": false
        }
    ],
    "groupOutlyingValues": {
        "enabled": false
    },
    "groupBy": [
        "cpcode"
    ],
    "filters": [
        {
            "name": "ip_version",
            "type": "enum",
            "description": "The IP for which the report is shown.",
            "values": [
                {
                    "value": "ipv4",
                    "description": "IP address in v4 format."
                },
                {
                    "value": "ipv6",
                    "description": "IP address in v6 format."
                }
            ],
            "required": false
        },
        {
            "name": "traffic",
            "type": "enum",
            "description": "HTTP traffic to be included in the report data.",
            "values": [
                {
                    "value": "put_post_requests",
                    "description": "Request traffic from PUT and POST operations."
                },
                {
                    "value": "get_head_responses",
                    "description": "Response header traffic from GET operations."
                },
                {
                    "value": "all_responses",
                    "description": "All response traffic."
                },
                {
                    "value": "put_post_responses",
                    "description": "Response traffic from PUT and POST operations."
                }
            ],
            "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": "http_version",
            "type": "enum",
            "description": "HTTP version.",
            "values": [
                {
                    "value": "https1.1",
                    "description": "https1.1"
                },
                {
                    "value": "http2",
                    "description": "http2"
                },
                {
                    "value": "http3",
                    "description": "http3"
                },
                {
                    "value": "http1.1",
                    "description": "http1.1"
                }
            ],
            "required": false
        },
        {
            "name": "response_code",
            "type": "string",
            "description": "An HTTP response status code, for example, 201.",
            "required": false
        },
        {
            "name": "delivery_type",
            "type": "enum",
            "description": "Distinguishes secure from non-secure traffic. ",
            "values": [
                {
                    "value": "secure",
                    "description": "Secure traffic."
                },
                {
                    "value": "non_secure",
                    "description": "Non-secure traffic."
                }
            ],
            "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": "ca",
            "type": "enum",
            "description": "Indicates whether content is storable. ",
            "values": [
                {
                    "value": "non_cacheable",
                    "description": "Can't be stored (identified as 'no-store' or has a 0 TTL) and will always trigger an origin request."
                },
                {
                    "value": "cacheable",
                    "description": "Can be stored after an initial request for faster future delivery."
                }
            ],
            "required": false
        }
    ],
    "intervals": [
        "MONTH",
        "WEEK",
        "DAY",
        "HOUR",
        "FIVE_MINUTES"
    ],
    "dataRetentionDays": 92,
    "links": [
        {
            "rel": "self",
            "href": "/reporting-api/v1/reports/hits-by-cpcode/versions/1"
        },
        {
            "rel": "versions",
            "href": "/reporting-api/v1/reports/hits-by-cpcode/versions"
        },
        {
            "rel": "all-reports",
            "href": "/reporting-api/v1/reports"
        },
        {
            "rel": "execute-report",
            "href": "/reporting-api/v1/reports/hits-by-cpcode/versions/1/report-data"
        }
    ]
}