Skip to content

Statistics

In this section you can find out about getting:

  • statistics via API;
  • partner CDN statistics via API;
  • raw logs via API or get-cdnvideo-logs.py script.

API statistics

General information

  • Request type: GET
  • Response data type: JSON
  • The response language is determined primarily from the language query string. If not specified, then Accept-Language from the request header. If both values ​​are not set, then English is selected. The language in which the response returned will be recorded in the Accept-Language response header
  • The authorization token is determined primarily from the cdnauthtoken query string. If not specified, then from the request header cdn-auth-token. If both are not set, then an error will be returned
  • The date value (start, end) is transmitted in the form: year-month-dayThours:minutes:seconds, where seconds should be equal to 00. Example 2020-02-11T12:30:00
  • The values ​​of country and region are codes. If they are present in the answer, then the values ​​of country_name and region_name are passed along with it, which return the names of the country and region in a readable form in the language that was selected
  • Using the sort parameter, you can specify the object and method of sorting. The sort parameter has the form: [+ -] {field} (for example, sorting by decreasing traffic -traffic)
  • The granularity format is: a simplified version P[n]Y[n]M[n]DT[n]H[n]M[n]S ("P1M", "PT5M", but not "P1DT12H")

Description of request headers:

Headers name Description Required
Accept-Language Locale No
cdn-auth-token Authorization Token Yes/No

Possible response codes:

Response code Response data Answer Description
200 OK successful request
401 token is invalid no token was specified
401 no accounts available for a given token there are no accounts available
401 account {account} is not available the specified account is not available
400 unknown path no specified path
400 required key {req} not in query string required parameter was not specified for this path
400 required key {req} for {req for} not in query string a required parameter was not specified for a specific parameter
400 {arg} is not possible query argument unknown parameter
400 {arg} is invalid query argument parameter has an invalid value
400 {arg} is invalid query argument (possible values: {possible values}) parameter has an invalid value
400 start must be less end start cannot be greater than or equal to end
400 granularity is not correct invalid granularity value
429 Too Many Requests too many requests
500 Internal Server Error unknown error
504 Gateway Timeout error query too long

Description of response parameters:

Parameter name Description
traffic Total traffic (in bytes)
cache_ratio Percentage of cache output (0 to 1 without rounding)
hits Number of connections
bandwidth Peak Speed ​​(in bps)

Summary data

URL: https://api.cdnvideo.ru/app/statistic/v3/

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&code=200&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "code": "200",
    "account": "account",
    "hits": 2104772,
    "traffic": 40603470765,
    "cache_ratio": 0.8231922443391645,
    "bandwidth": 5612541
}

Grouping data

Labels

URL: https://api.cdnvideo.ru/app/statistic/v3/customs

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/customs?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "custom": "Empty",
            "hits": 2104772,
            "traffic": 40603470765,
            "cache_ratio": 0.8231922443391645,
            "bandwidth": 5612541
        }
    ]
}

Referrers

URL: https://api.cdnvideo.ru/app/statistic/v3/referrers

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/referrers?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "referrer": "bbs.site.com",
            "hits": 4,
            "traffic": 271892,
            "cache_ratio": 0,
            "bandwidth": 36252
        },
        {
            "referrer": "m.site.com",
            "hits": 1036,
            "traffic": 143807741,
            "cache_ratio": 0.9638908033469492,
            "bandwidth": 423878
        },
        ...
    ]
}

Response codes

URL: https://api.cdnvideo.ru/app/statistic/v3/codes

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/codes?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "code": 200,
            "hits": 2057042,
            "traffic": 40551420934,
            "cache_ratio": 0.8230137369124231,
            "bandwidth": 5612518
        },
        {
            "code": 206,
            "hits": 540,
            "traffic": 43568848,
            "cache_ratio": 0.9719663232775858,
            "bandwidth": 231773
        },
        {
            "code": 304,
            "hits": 46079,
            "traffic": 8040265,
            "cache_ratio": 0.9624426558079864,
            "bandwidth": 603
        },
        ...
    ]
}

Regions

URL: https://api.cdnvideo.ru/app/statistic/v3/regions

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/regions?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "country": "KZ",
            "region": "02",
            "hits": 61,
            "traffic": 1014350,
            "cache_ratio": 0.4619707201656233,
            "bandwidth": 47076,
            "country_name": "Kazakhstan",
            "region_name": "Almaty"
        },
        {
            "country": "CN",
            "region": "11",
            "hits": 64930,
            "traffic": 794182327,
            "cache_ratio": 0.9765737333009175,
            "bandwidth": 373489,
            "country_name": "People's Republic of China",
            "region_name": "Hunan Province"
        },
        ...
    ]
}

Browsers

URL: https://api.cdnvideo.ru/app/statistic/v3/browsers

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/browsers?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "browser": "AndroidBrowser",
            "hits": 10240,
            "traffic": 425445359,
            "cache_ratio": 0.8885248645995925,
            "bandwidth": 405949
        },
        {
            "browser": "UC Browser",
            "hits": 3639,
            "traffic": 294130341,
            "cache_ratio": 0.8235374636171927,
            "bandwidth": 667600
        },
        ...
    ]
}

Platforms

URL: https://api.cdnvideo.ru/app/statistic/v3/platforms

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/platforms?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "platform": "ChromeOS",
            "hits": 1,
            "traffic": 182095,
            "cache_ratio": 1,
            "bandwidth": 24279
        },
        {
            "platform": "iOS",
            "hits": 148418,
            "traffic": 2307262894,
            "cache_ratio": 0.961626801943446,
            "bandwidth": 850371
        },
        ...
    ]
}

Resources

URL: https://api.cdnvideo.ru/app/statistic/v3/resources

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name Yes
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/resources?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "resource": "l36fqysvkx",
            "hits": 2104772,
            "traffic": 40603470765,
            "cache_ratio": 0.8231922443391645,
            "bandwidth": 5612541,
            "resource_name": "name"
        }
    ]
}

Hosts

URL: https://api.cdnvideo.ru/app/statistic/v3/hosts

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name Yes
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/hosts?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "host": "cdn3.img.site.cn",
            "hits": 2103176,
            "traffic": 40497105719,
            "cache_ratio": 0.8229884518478865,
            "bandwidth": 5612541
        },
        {
            "host": "l36sdfyzlkx.a.trbcdn.net",
            "hits": 1596,
            "traffic": 106365046,
            "cache_ratio": 0.9007835807263225,
            "bandwidth": 80317
        },
    ]
}

Paths

URL: https://api.cdnvideo.ru/app/statistic/v3/paths

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name Yes
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL Yes
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/paths?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account&host=cdn3.img.site.cn'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "host": "cdn3.img.site.cn",
    "result": [
        {
            "path": "/images/102519/05/1025190554.jpg",
            "hits": 8,
            "traffic": 947264,
            "cache_ratio": 0.875,
            "bandwidth": 31575
        },
        {
            "path": "/images/102167/96/1021679638.jpg",
            "hits": 1,
            "traffic": 119581,
            "cache_ratio": 1,
            "bandwidth": 15944
        },
        ...
    ]
}

Countries

URL: https://api.cdnvideo.ru/app/statistic/v3/countries

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/countries?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "country": "GB",
            "hits": 2,
            "traffic": 268648,
            "cache_ratio": 0.668547690658408,
            "bandwidth": 23947,
            "country_name": "United Kingdom"
        },
        {
            "country": "KR",
            "hits": 6,
            "traffic": 417296,
            "cache_ratio": 1,
            "bandwidth": 31848,
            "country_name": "South Korea"
        },
        ...
    ]
}

Accounts

URL: https://api.cdnvideo.ru/app/statistic/v3/accounts

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/accounts?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "account": "account",
    "result": [
        {
            "account": "account",
            "hits": 2104772,
            "traffic": 40603470765,
            "cache_ratio": 0.8231922443391645,
            "bandwidth": 5612541
        }
    ]
}

Times

URL: https://api.cdnvideo.ru/app/statistic/v3/times

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "hits": 194399,
            "traffic": 2393556992,
            "cache_ratio": 0.9263462990063618,
            "bandwidth": 2088376
        },
        {
            "start": "2019-08-02T00:00:00",
            "end": "2019-08-03T00:00:00",
            "hits": 255208,
            "traffic": 3823467560,
            "cache_ratio": 0.9046492924867394,
            "bandwidth": 5299504
        },
        ...
    ]
}

Grouping data based on time

Labels

URL: https://api.cdnvideo.ru/app/statistic/v3/times/customs

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/customs?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "custom": "Empty",
                    "hits": 194399,
                    "traffic": 2393556992,
                    "cache_ratio": 0.9263462990063618,
                    "bandwidth": 2088376
                }
            ]
        },
        {
            "start": "2019-08-02T00:00:00",
            "end": "2019-08-03T00:00:00",
            "result": [
                {
                    "custom": "Empty",
                    "hits": 255208,
                    "traffic": 3823467560,
                    "cache_ratio": 0.9046492924867394,
                    "bandwidth": 5299504
                }
            ]
        },
        ...
    ]
}

Referrers

URL: https://api.cdnvideo.ru/app/statistic/v3/times/referrers

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/referrers?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "referrer": "site.com",
                    "hits": 11,
                    "traffic": 1064740,
                    "cache_ratio": 1,
                    "bandwidth": 56634
                },
                {
                    "referrer": "club.site.net",
                    "hits": 3,
                    "traffic": 139472,
                    "cache_ratio": 1,
                    "bandwidth": 13992
                },
                ...
            ]
        },
        ...
    ]
}

Response codes

URL: https://api.cdnvideo.ru/app/statistic/v3/times/codes

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/codes?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "code": 404,
                    "hits": 81,
                    "traffic": 30684,
                    "cache_ratio": 0,
                    "bandwidth": 1340
                },
                {
                    "code": 200,
                    "hits": 192882,
                    "traffic": 2393162042,
                    "cache_ratio": 0.9263477491675843,
                    "bandwidth": 2088353
                },
                ...
            ]
        },
        ...
    ]
}

Regions

URL: https://api.cdnvideo.ru/app/statistic/v3/times/regions

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/regions?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "country": "UA",
                    "region": "17",
                    "hits": 1,
                    "traffic": 144295,
                    "cache_ratio": 0,
                    "bandwidth": 19239,
                    "country_name": "Ukraine",
                    "region_name": "Odessa Oblast"
                },
                {
                    "country": "RU",
                    "region": "65",
                    "hits": 1,
                    "traffic": 121598,
                    "cache_ratio": 0,
                    "bandwidth": 16213,
                    "country_name": "Russia",
                    "region_name": ""
                },
                ...
            ]
        },
        ...
    ]
}

Browsers

URL: https://api.cdnvideo.ru/app/statistic/v3/times/browsers

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/browsers?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "browser": "Maxthon Browser",
                    "hits": 7,
                    "traffic": 433197,
                    "cache_ratio": 1,
                    "bandwidth": 21010
                },
                {
                    "browser": "Safari",
                    "hits": 145,
                    "traffic": 13990289,
                    "cache_ratio": 0.9408025809902855,
                    "bandwidth": 302202
                },
                ...
            ]
        },
        ...
    ]
}

Platforms

URL: https://api.cdnvideo.ru/app/statistic/v3/times/platforms

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/platforms?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "platform": "Windows",
                    "hits": 3,
                    "traffic": 107880,
                    "cache_ratio": 1,
                    "bandwidth": 14272
                },
                {
                    "platform": "Windows 8.0",
                    "hits": 1,
                    "traffic": 23184,
                    "cache_ratio": 1,
                    "bandwidth": 3091
                },
                ...
            ]
        },
        ...
    ]
}

Resources

URL: https://api.cdnvideo.ru/app/statistic/v3/times/resources

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name Yes
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/resources?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "resource": "l36fqysvkx",
                    "hits": 194399,
                    "traffic": 2393556992,
                    "cache_ratio": 0.9263462990063618,
                    "bandwidth": 2088376,
                    "resource_name": "name"
                }
            ]
        },
        {
            "start": "2019-08-02T00:00:00",
            "end": "2019-08-03T00:00:00",
            "result": [
                {
                    "resource": "l36fqysvkx",
                    "hits": 255208,
                    "traffic": 3823467560,
                    "cache_ratio": 0.9046492924867394,
                    "bandwidth": 5299504,
                    "resource_name": "name"
                }
            ]
        },
        ...
    ]
}

Hosts

URL: https://api.cdnvideo.ru/app/statistic/v3/times/hosts

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name Yes
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/hosts?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "host": "l36sdfyzlkx.a.trbcdn.net",
                    "hits": 46,
                    "traffic": 2884615,
                    "cache_ratio": 0.8728790497172066,
                    "bandwidth": 33997
                },
                {
                    "host": "cdn3.img.site.cn",
                    "hits": 194353,
                    "traffic": 2390672377,
                    "cache_ratio": 0.9264108132538146,
                    "bandwidth": 2088376
                }
            ]
        },
        ...
    ]
}

Paths

URL: https://api.cdnvideo.ru/app/statistic/v3/times/paths

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name Yes
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL Yes
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/paths?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account&host=cdn3.img.site.cn'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "host": "cdn3.img.site.cn",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "path": "/images/102686/65/1026866540.png",
                    "hits": 1,
                    "traffic": 175,
                    "cache_ratio": 1,
                    "bandwidth": 23
                },
                {
                    "path": "/images/101735/33/1017353398.jpg",
                    "hits": 1,
                    "traffic": 60231,
                    "cache_ratio": 1,
                    "bandwidth": 8030
                },
                ...
            ]
        },
        ...
    ]
}

Countries

URL: https://api.cdnvideo.ru/app/statistic/v3/times/countries

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
platform Platform (OS) No
browser Browser No
host host part of the URL No
path path part of the URL No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No
resource Resource id No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/countries?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "country": "HK",
                    "hits": 4,
                    "traffic": 456213,
                    "cache_ratio": 0.20934081229601084,
                    "bandwidth": 27491,
                    "country_name": "Hong Kong"
                },
                {
                    "country": "RU",
                    "hits": 292,
                    "traffic": 167895032,
                    "cache_ratio": 0.2885433918020874,
                    "bandwidth": 1149619,
                    "country_name": "Russia"
                },
                ...
            ]
        },
        ...
    ]
}

Accounts

URL: https://api.cdnvideo.ru/app/statistic/v3/times/accounts

Description of request parameters:

Parameter name Description Required
language Locale No
cdnauthtoken Authorization Token Yes/No
start Date from which the calculation is made (inclusive) Yes
end Date until which the calculation is made (not inclusive) Yes
granularity Granularity Yes
service Type of service (media / static, if not specified, then both) No
account Account name No
country Country (code) No
region Region (code) No
platform Platform (OS) No
browser Browser No
referrer Referrer No
code Response code No
custom Label No
sort Object and sorting method No
offset Result bias No
limit Result limitation No
fields Fields whose values ​​you want to return (traffic, cache_ratio, hits, bandwidth) No

Request example

curl -H 'cdn-auth-token: cdn1_D8041SUTFHAV05HRKYEDQAZY5GOWWY' 'https://api.cdnvideo.ru/app/statistic/v3/times/accounts?start=2019-08-01T11:01:00&end=2019-08-19T10:01:00&granularity=P1D&account=account'

Success Response Example

{
    "start": "2019-08-01T11:01:00",
    "end": "2019-08-19T10:01:00",
    "granularity": "P1D",
    "account": "account",
    "result": [
        {
            "start": "2019-08-01T11:01:00",
            "end": "2019-08-02T00:00:00",
            "result": [
                {
                    "account": "account",
                    "hits": 194399,
                    "traffic": 2393556992,
                    "cache_ratio": 0.9263462990063618,
                    "bandwidth": 2088376
                }
            ]
        },
        {
            "start": "2019-08-02T00:00:00",
            "end": "2019-08-03T00:00:00",
            "result": [
                {
                    "account": "account",
                    "hits": 255208,
                    "traffic": 3823467560,
                    "cache_ratio": 0.9046492924867394,
                    "bandwidth": 5299504
                }
            ]
        },
        ...
    ]
}

Partner CDN Statistics API

This section describes how you can get statistics of distribution in additional areas.

These areas include:

  • EMEA (Europe, Middle East and Africa);
  • APAC (Asia-Pacific region and Japan);
  • AM (America).

Traffic statistics

This method is used to get values of traffic at specific time intervals.

URL: https://api.cdnvideo.ru/app/stat-ext-1/v1/p1/traffic?account=<account>&hostname=<hostname>&area=<area>&startdate=<start_date>&enddate=<end_date>&granularity=<granularity>

  • Method: GET
  • Headers: CDN-AUTH-TOKEN
  • GET-parameters (* - required):

    1. account - account name;
    2. hostname - domain;
    3. area - additional distribution areas (apac/am/emea);
    4. startdate * - the interval start date and time in format YYYY-MM-DDTHH:mm:ssZ (UTC);
    5. enddate - the interval end date and time in format YYYY-MM-DDTHH:mm:ssZ (UTC).

      If this parameter is not specified, then the response contains intervals for which start = startdate;

    6. granularity - granularity, the size of the intervals in the response (in seconds).

  • Response Data Type: JSON Object. The value of the traffic is returned in the "value" key (in bytes).

Status Code Response Data Response Format Description
200 Traffic statistics JSON OK
400 None None Bad request
401 None None No access
404 None None Not Found
405 None None Method Not Allowed
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_OSKVHEJCGDOPEQJJXQN284ZTQUEPJ2'
https://api.cdnvideo.ru/app/stat-ext-1/v1/p1/traffic?account=paejgjuv&startdate=2019-10-01T16:40:00Z&enddate=2019-10-01T17:00:00Z&granularity=300

Successful response example

{
  "response": [
    [
      {
        "account": "paejgjuv",
        "intervals": [
          {
            "start": "2019-10-01T16:40:00Z",
            "end": "2019-10-01T16:45:00Z",
            "value": 648877
          },
          {
            "start": "2019-10-01T16:45:00Z",
            "end": "2019-10-01T16:50:00Z",
            "value": 2551568
          },
          {
            "start": "2019-10-01T16:50:00Z",
            "end": "2019-10-01T16:55:00Z",
            "value": 6860538
          },
          {
            "start": "2019-10-01T16:55:00Z",
            "end": "2019-10-01T17:00:00Z",
            "value": 5786
          }
        ]
      }
    ]
  ]
}

Unsuccessful response example

{
  "error": {
    "message": "API access denied: invalid token",
    "code": 401
  }
}

Bandwidth statistics

This method is used to get values of bandwidth at specific time intervals.

URL: https://api.cdnvideo.ru/app/stat-ext-1/v1/p1/bandwidth?account=<account>&hostname=<hostname>&area=<area>&startdate=<start_date>&enddate=<end_date>&granularity=<granularity>

  • Method: GET
  • Headers: CDN-AUTH-TOKEN
  • GET-parameters (* - required):

    1. account - account name;
    2. hostname - domain;
    3. area - additional distribution areas (apac/am/emea);
    4. startdate * - the interval start date and time in format YYYY-MM-DDTHH:mm:ssZ (UTC);
    5. enddate - the interval end date and time in format YYYY-MM-DDTHH:mm:ssZ (UTC).

      If this parameter is not specified, then the response contains intervals for which start = startdate;

    6. granularity - granularity, the size of the intervals in the response (in seconds).

  • Response Data Type: JSON Object. The value of the bandwidth is returned in the "value" key (in Mbit/s).

Status Code Response Data Response Format Description
200 Bandwidth statistics JSON OK
400 None None Bad request
401 None None No access
404 None None Not Found
405 None None Method Not Allowed
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_OSKVHEJCGDOPEQJJXQN284ZTQUEPJ2'
'https://api.cdnvideo.ru/app/stat-ext-1/v1/p1/bandwidth?account=paejgjuv&area=apac&startdate=2019-10-01T16:40:00Z&enddate=2019-10-01T17:00:00Z&granularity=300'

Successful response example

{
  "response": [
    [
      {
        "account": "paejgjuv",
        "intervals": [
          {
            "start": "2019-10-01T16:40:00Z",
            "end": "2019-10-01T16:45:00Z",
            "value": 0.07571
          },
          {
            "start": "2019-10-01T16:45:00Z",
            "end": "2019-10-01T16:50:00Z",
            "value": 0.01729
          },
          {
            "start": "2019-10-01T16:50:00Z",
            "end": "2019-10-01T16:55:00Z",
            "value": 0.42443
          },
          {
            "start": "2019-10-01T16:55:00Z",
            "end": "2019-10-01T17:00:00Z",
            "value": 0.06633
          }
        ],
        "area": "apac"
      }
    ]
  ]
}

Unsuccessful response example

{
  "error": {
    "message": "Not authorized to request account paejgjuv",
    "code": 401
  }
}

Download of server logs

Log file record description

Log file begins with header line which is tab-separated list of fields names.

Following lines are log records, with values separated by tabulation. Order of values corresponds to order of fields names in header line. Set and order of fields is not fixed and may be changed in future.

Field name Field description Example
timestamp Date and time in UNIX timestamp format 1417135813.178
remote_addr User's IP-address 81.19.133.15
remote_user (service field) -
time_local Date and time in a readable format 2019-09-16 12:00:16+0000
request Path to a file or a video stream /live/smil:chanel1.smil/m_b1600000_126952.ts
status Response status 200
body_bytes_sent Total bytes sent (without header) 80840
out_bytes Total bytes sent (including header) 81076
referrer Referrer HTTP-header http://www.site1.com/
useragent Agent/browser of web user Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36
http_x_forwarded_for Content of HTTP-header X-Forwarded-For 192.168.7.114, 192.168.0.205, 81.19.133.15
host Requested host name site1.cdnvideo.com
torso_id (service field) -
duration Duration of full request or duration of part of request in progress, in seconds 0.616
upstream_response_time Origin response time in seconds. Times of several responses are separated by commas 0.021
upstream_status Origin response status (if cache miss). Status codes of several responses are separated by commas 200
country Country code from ISO_3166-1 US
service Service type (static - "Web content acceleration", media - "Live streaming and VOD") media
cache_status CDN response status (HIT - from the CDN cache, MISS - response was proxied to origin server) HIT
logtype (service field) -
custom_field (optional) some additional value

Checking logs existence API

Checking the existence of log records for a certain interval of time.

Query template for checking a logs for a specific time interval:

URL: https://api.cdnvideo.ru/app/logs/v1/accounts/<your_account_name>/exists?startdate=<start_date>&enddate=<end_date>

  • Method: GET
  • Headers: CDN-AUTH-TOKEN
  • Required GET-parameters:
    1. startdate — the interval start date and time in format YYYY-MM-DDTHH:mm:ssZ
    2. enddate — the interval end date and time in format YYYY-MM-DDTHH:mm:ssZ
  • Response Data Type: JSON Object or String in case of error
Status Code Response Data Response Format Description
200 Information on the availability of logs for a certain time interval JSON OK
400 None None Bad request
401 None None No access
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_OSKVHEJCGDOPEQJJXQN284ZTQUEPJ2'
https://api.cdnvideo.ru/app/logs/v1/accounts/paejgjuv/exists?startdate=2019-08-01T00:00:00Z&enddate=2019-09-01T00:00:00Z

Successful response example

{
    "account": "paejgjuv",
    "startdate": "2019-08-01T00:00:00+0000",
    "enddate": "2019-09-01T00:00:00+0000",
    "exists": true
}

Unsuccessful response example

No startdate or enddate in query

Description of the fields from the response body:

  • account - account name;
  • startdate - the interval start date and time;
  • enddate - the interval end date and time;
  • exists - logs exists status, true — if there are one or more strings, else — false.

Getting logs API

Query template for getting a log file for a certain time interval in a gzip stream format:

URL: https://api.cdnvideo.ru/app/logs/v1/accounts/<your_account_name>/get?startdate=<start_date>&enddate=<end_date>

  • Method: GET
  • Headers: CDN-AUTH-TOKEN
  • Required GET-parameters:
    1. startdate — the interval start date and time in format YYYY-MM-DDTHH:mm:ssZ
    2. enddate — the interval end date and time in format YYYY-MM-DDTHH:mm:ssZ
  • Response Data Type: JSON Object or String in case of error
Status Code Response Data Response Format Description
200 Logs for a certain time interval gzip stream OK
400 None None Bad request
401 None None No access
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_OSKVHEJCGDOPEQJJXQN284ZTQUEPJ2'
https://api.cdnvideo.ru/app/logs/v1/accounts/paejgjuv/get?startdate=2019-08-01T00:00:00Z&enddate=2019-09-01T00:00:00Z

Response contains body with log in a gzip stream format for time interval from GET-parameters. A detailed description of the resulting log file is described below.

Getting logs via get-cdnvideo-logs.py

To download logs, you can use the script get-cdnvideo-logs.py (download the script).

Installation

  • Install pip (example of installation at RHEL, CentOS, Fedora):

    sudo yum install python-pip
    
  • Install a library of requests:

    pip install requests
    
  • Put get-cdnvideo-logs.py in respective directory.

Execution

The software is a simple console python-script that accepts various arguments.It outputs a stream in gzip format.

get-cdnvideo-logs.py accepts the following arguments (* - required):

  1. --account * (-a) - account name.
  2. --username * (-u) - client`s username.
  3. --password (-p) - client`s password. If no argument:
    • Environment variable “CDNVIDEO_PASSWORD” can be used;
    • Password will be requested before script starts.
  4. --date * (-d). Defines the date filter for log records. The log can be uploaded with hour accuracy. Possible values:

    • 2019-08. A log for August 2019
    • 2019-08-23. A log for August 23, 2019
    • 2019-08-23-04. A log for August 23, 2019, starting from 4 a.m. (UTC)

    Warning!

    Time parameter is specified in MSK.

  5. --progressbar (-pb). Download progress bar.

    Warning!

    Required special python module.

  6. --file (-f). Logs output in file $account_$date.txt.gz . By default script write a stream of gzipped logs to STDOUT.

Possible usage scenario:

  1. Download a log for 23th of August 2019 and save to file account_2019-08-23.txt.gz

    python get-cdnvideo-logs.py -a account -u username -d 2019-08-23 -f
    
  2. Download a log for August of 2019 with progress bar and save to file account_2019-08.txt.gz

    python get-cdnvideo-logs.py -a account -u username -d 2019-08 -pb -f
    

Errors

  1. "Error: A connection error occurred"

    Possible reasons: Failure of Internet connection, network problems. Server went down.

    Actions:

    1. Make sure that you are connected to Internet

      ping google.com
      
    2. If it did not help, please contact support.

  2. "Timeout: page connection timeout more than seconds: 5"

    Possible reasons: Server does not respond, network problems.

    Actions:

    1. Check network connection.
    2. Contact support.
  3. "Error: Wrong username or password"

    Possible reasons: Specified login/password pair is invalid (arguments -u username, -p password)

    Actions:

    1. Make sure that username and password are filled out correctly.
    2. Contact support.
  4. "Error: account not found"

    Possible reasons: no account for username.

    Actions:

    1. Make sure that account is filled out correctly for username.
    2. Contact support.
  5. "Error: We don't have any log for this date"

    Reason: We don’t have any log for this period or for such service.

    Actions:

    1. Check traffic in statistics management section for required time interval.
    2. Check logs existing via API.
    3. Contact support.
  6. "Error: Problem with server/page down"

    Possible reasons: Problems with server.

    Actions:

    1. Contact support.