Statistics
In this section you can find out about getting:
- statistics via API;
- raw logs via API.
API statistics
General information
Warning!
- There is a limit on the number of API calls:
- no more than 5 requests per minute.
- The statistics lag can be up to an hour. To obtain statistics with minimal latency, use realtime statistics API
- 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. Specified in UTC. 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 | the specified account is not available |
400 | unknown path | no specified path |
400 | required key | required parameter was not specified for this path |
400 | required key | a required parameter was not specified for a specific parameter |
400 | unknown parameter | |
400 | parameter has an invalid value | |
400 | parameter has an invalid value | |
400 | start must be less then 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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/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: $TOKEN" 'https://api-cdn.platformcraft.com/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 } ] }, ... ] }
API stream statistics
General information
Warning!
- There is a limit on the number of API calls:
- no more than 30 requests per minute.
- 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) uses the ISO8601 standard in UTC format with zero seconds. For example, 2020-08-01T00:00:00Z or 2020-08-01T00:00:00
- To specify the date, the request must specify start and end
- 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
- To filter by region, you must specify the country
- To filter by stream, you must specify an account
- The offset argument can only be specified with limit
- 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 unique users -users)
- The granularity is in ISO 8601 format. Available Values: PT1M, PT5M, PT15M, PT1H, P1D, P1W, P1M, P1Y
- The locale is represented in the response header Accept-Language and complies with the RFC 7231 specification. Consists of a two-letter main language tag. Possible values: en and ru
- While the enduser watches the stream, the user's device downloads video and audio segments of the stream. Stream statistics are calculated using log records of segments download
- User is defined as a combination (IP-address, User-Agent)
- Single view of the stream is defined as one or more consecutive requests for stream segments from one User having gaps between requests less than 1 minute
Description of request headers:
Headers name | Description | Required |
---|---|---|
Accept-Language | Locale | Нет |
cdn-auth-token | Authorization Token | Yes/No |
Possible response codes:
Response code | Response data | Answer Description |
---|---|---|
200 | OK | successful request |
400 | validation fail | another validation error |
400 | sort argument not in fields | the specified sort parameter is not specified in fields |
400 | start must be less then end | start cannot be greater than or equal to end |
400 | granularity is not correct | invalid granularity value |
401 | token is invalid | no token was specified |
401 | no accounts available | for a given token there are no accounts available |
401 | account | the specified account is not available |
422 | one of the passed parameters is incorrectly set (message contains a more detailed description) | |
429 | Too Many Requests | too many requests |
500 | Internal Server Error | internal error |
504 | Gateway Timeout error | query too long |
Description of response parameters:
Parameter name | Description |
---|---|
views | Sum of single views for the given time interval |
users | Number of unique User for the given time interval |
views_max | Maximum of simultaneous views for the given time interval |
Summary data
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&fields=views,users,views_max&account=account'
Success Response Example
{ "views": 631185, "users": 59337, "views_max": 9426, "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z" }
Grouping data
Streams
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/streams
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/streams?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&account=account'
Success Response Example
{ "result": [ { "account": "account", "views": 6737, "users": 5382, "views_max": 356, "stream": "stream_name1" }, { "account": "account", "views": 6438, "users": 5145, "views_max": 343, "stream": "stream_name2" } ], "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Accounts
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/accounts
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/accounts?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max'
Success Response Example
{ "result": [ { "views": 281509, "users": 28160, "views_max": 56359, "account": "account1" }, { "views": 75720, "users": 29770, "views_max": 12300, "account": "account2" } ], "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Browsers
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/browsers
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/browsers?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&account=account'
Success Response Example
{ "result": [ { "views": 477309, "users": 16346, "views_max": 8057, "browser": "AndroidBrowser" }, { "views": 145386, "users": 41285, "views_max": 1287, "browser": "TV" } ], "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Platforms
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/platforms
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/platforms?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&account=account'
Success Response Example
{ "result": [ { "views": 772199, "users": 20384, "views_max": 9229, "platform": "Android" }, { "views": 235102, "users": 63074, "views_max": 1439, "platform": "iOS" } ], "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Countries
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/countries
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/countries?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&account=account'
Success Response Example
{ "result": [ { "views": 1032159, "users": 84212, "views_max": 10871, "country": "RU", "country_name": "Russia" }, { "views": 7, "users": 2, "views_max": 7, "country": "GB", "country_name": "United Kingdom" } ], "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Regions
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/regions
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/regions?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&account=account'
Success Response Example
{ "result": [ { "views": 250940, "users": 28756, "views_max": 3911, "country": "RU", "region": "48", "country_name": "Russia", "region_name": "Moscow" }, { "views": 88396, "users": 9042, "views_max": 1559, "country": "RU", "region": "71", "country_name": "Russia", "region_name": "Sverdlovsk" } ], "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Time intervals
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/times
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
granularity | Granularity | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/times?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&granularity=PT1H&account=account'
Success Response Example
{ "result": [ { "views": 96352, "users": 10483, "views_max": 9426, "start": "2020-08-01T15:00:00Z", "end": "2020-08-01T16:00:00Z" }, { "views": 92464, "users": 9573, "views_max": 9009, "start": "2020-08-01T14:00:00Z", "end": "2020-08-01T15:00:00Z" } ], "granularity": "PT1H", "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Grouping data based on time
Streams
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/times/streams
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
granularity | Granularity | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/times/streams?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&granularity=PT1H&account=account'
Success Response Example
{ "result": [ { "start": "2020-08-01T15:00:00Z", "end": "2020-08-01T16:00:00Z", "result": [ { "account": "account", "views": 1576, "users": 1396, "views_max": 272, "stream": "stream_name1" }, { "account": "account", "views": 1558, "users": 1374, "views_max": 260, "stream": "stream_name2" } ] } ], "granularity": "PT1H", "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Accounts
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/times/accounts
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
granularity | Granularity | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/times/accounts?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&granularity=PT1H'
Success Response Example
{ "result": [ { "start": "2020-08-01T19:00:00Z", "end": "2020-08-01T20:00:00Z", "result": [ { "views": 56359, "users": 11171, "views_max": 56359, "account": "account1" } ] }, { "start": "2020-08-01T16:00:00Z", "end": "2020-08-01T17:00:00Z", "result": [ { "views": 49772, "users": 10646, "views_max": 49772, "account": "account2" } ] } ], "granularity": "PT1H", "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Browsers
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/times/browsers
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
granularity | Granularity | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/times/browsers?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&granularity=PT1H&account=account'
Success Response Example
{ "result": [ { "start": "2020-08-01T15:00:00Z", "end": "2020-08-01T16:00:00Z", "result": [ { "views": 74535, "users": 3931, "views_max": 8057, "browser": "AndroidBrowser" } ] }, { "start": "2020-08-01T14:00:00Z", "end": "2020-08-01T15:00:00Z", "result": [ { "views": 72059, "users": 3868, "views_max": 7893, "browser": "AndroidBrowser" } ] } ], "granularity": "PT1H", "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Platforms
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/times/platforms
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
granularity | Granularity | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/times/platforms?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&granularity=PT1H&account=account'
Success Response Example
{ "result": [ { "start": "2020-08-01T16:00:00Z", "end": "2020-08-01T17:00:00Z", "result": [ { "views": 80156, "users": 4379, "views_max": 9163, "platform": "Android" } ] }, { "start": "2020-08-01T19:00:00Z", "end": "2020-08-01T20:00:00Z", "result": [ { "views": 75559, "users": 4203, "views_max": 9229, "platform": "Android" } ] } ], "granularity": "PT1H", "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Countries
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/times/countries
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
granularity | Granularity | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/times/countries?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&granularity=PT1H&account=account'
Success Response Example
{ "result": [ { "start": "2020-08-01T16:00:00Z", "end": "2020-08-01T17:00:00Z", "result": [ { "views": 105294, "users": 12113, "views_max": 10764, "country": "RU", "country_name": "Russia" } ] }, { "start": "2020-08-01T19:00:00Z", "end": "2020-08-01T20:00:00Z", "result": [ { "views": 98352, "users": 10583, "views_max": 10871, "country": "RU", "country_name": "Russia" } ] } ], "granularity": "PT1H", "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
Regions
URL: https://api-cdn.platformcraft.com/app/streamstat/v2/times/regions
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
language | Locale (ru or en) | No |
cdnauthtoken | Authorization Token | Yes/No |
start | Datetime from which the calculation is made (inclusive) | Yes |
end | Datetime until which the calculation is made (not inclusive) | Yes |
granularity | Granularity | Yes |
account | Account name | No |
stream | Stream name (several can be specified, for example ..? Stream = stream_name1 & stream = stream_name2) | No |
country | Country (code) | No |
region | Region (code) | No |
browser | Browser | No |
platform | Platform (OS) | No |
fields | Fields to return values (views_max, views, users) | No |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api-cdn.platformcraft.com/app/streamstat/v2/times/regions?start=2020-08-01T00:00:00Z&end=2020-08-02T00:00:00Z&sort=-views&limit=2&fields=views,users,views_max&granularity=PT1H&account=account'
Success Response Example
{ "result": [ { "start": "2020-08-01T19:00:00Z", "end": "2020-08-01T20:00:00Z", "result": [ { "views": 45884, "users": 5163, "views_max": 5134, "country": "RU", "region": "48", "country_name": "Russia", "region_name": "Moscow" } ] }, { "start": "2020-08-01T16:00:00Z", "end": "2020-08-01T17:00:00Z", "result": [ { "views": 42318, "users": 5825, "views_max": 4060, "country": "RU", "region": "48", "country_name": "Russia", "region_name": "Moscow" } ] } ], "granularity": "PT1H", "start": "2020-08-01T00:00:00Z", "fields": [ "views", "users", "views_max" ], "account": "account", "end": "2020-08-02T00:00:00Z", "limit": 2, "sort": "-views" }
API realtime bandwidth statistics
General information
This API is used to get values of bandwidth at current time.
Recommendation
For optimal work with the API, it is recommended to send 1 request in 10 seconds.
Description of response parameters:
Parameter name | Description |
---|---|
bandwidth_out_bits_per_second | Bandwidth (bits per second) |
requests_per_second | Requests per second |
http_status_percent | distribution of HTTP status codes (percent of requests) |
cache_status_percent_by_requests | Distribution of cache HIT and MISS (percent of requests) |
cache_status_percent_by_volume | Distribution of cache HIT and MISS (percent of traffic) |
API returns an empty list []
if there is no traffic for available accounts.
Statistics for all available accounts
This method is used to get values of bandwidth at current time for all available accounts.
URL: https://api-cdn.platformcraft.com/app/realtimestat/v1/accounts
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Array
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/realtimestat/v1/accounts'
Successful response example
[ { "http_status_percent": { "200": 100 }, "account": "account1", "cache_status_percent_by_requests": { "HIT": 100, "MISS": 0 }, "cache_status_percent_by_volume": { "HIT": 100, "MISS": 0 }, "requests_per_second": 0.5443, "bandwidth_out_bits_per_second": 2037575.4037 }, { "http_status_percent": { "200": 72.9239, "404": 0.0865, "304": 26.1678, "499": 0.2595, "206": 0.5623 }, "account": "account2", "cache_status_percent_by_requests": { "HIT": 98.7457, "MISS": 1.2543 }, "cache_status_percent_by_volume": { "HIT": 97.6446, "MISS": 2.3554 }, "requests_per_second": 114.4467, "bandwidth_out_bits_per_second": 104866402.3032 } ]
Statistics for a specific account
This method is used to get values of bandwidth at current time for a specific account.
URL: https://api-cdn.platformcraft.com/app/realtimestat/v1/accounts/<account>
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Array
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/realtimestat/v1/accounts/account1'
Successful response example
[ { "http_status_percent": { "200": 100 }, "account": "account1", "cache_status_percent_by_requests": { "HIT": 100, "MISS": 0 }, "cache_status_percent_by_volume": { "HIT": 100, "MISS": 0 }, "requests_per_second": 0.5443, "bandwidth_out_bits_per_second": 2037575.4037 } ]
Statistics by resources for a specific account
This method is used to get values of bandwidth at current time for a specific account. Returns a response for each resource of account.
URL: https://api-cdn.platformcraft.com/app/realtimestat/v1/accounts/<account>/resources
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Array
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/realtimestat/v1/accounts/account1/resources'
Successful response example
[ { "http_status_percent": { "200": 100 }, "account": "account1", "resource": "1", "cache_status_percent_by_requests": { "HIT": 100, "MISS": 0 }, "cache_status_percent_by_volume": { "HIT": 100, "MISS": 0 }, "requests_per_second": 0.5443, "bandwidth_out_bits_per_second": 2037575.4037 }, { "http_status_percent": { "200": 100 }, "account": "account1", "resource": "2", "cache_status_percent_by_requests": { "HIT": 100, "MISS": 0 }, "cache_status_percent_by_volume": { "HIT": 100, "MISS": 0 }, "requests_per_second": 0.3443, "bandwidth_out_bits_per_second": 1037575.1234 } ]
Statistics for a specific resource
This method is used to get values of bandwidth at current time for a specific resource of account.
URL: https://api-cdn.platformcraft.com/app/realtimestat/v1/accounts/<account>/resources/<resource>
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Array
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/realtimestat/v1/accounts/account1/resources/1'
Successful response example
[ { "http_status_percent": { "200": 100 }, "account": "account1", "resource": "1", "cache_status_percent_by_requests": { "HIT": 100, "MISS": 0 }, "cache_status_percent_by_volume": { "HIT": 100, "MISS": 0 }, "requests_per_second": 0.5443, "bandwidth_out_bits_per_second": 2037575.4037 } ]
API active stream statistics
General information
This API is used to get information about stream views at current time.
Description of request headers:
Header name | Description | Required |
---|---|---|
CDN-AUTH-TOKEN | Authorization Token | Yes |
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
account | Account name | No |
fields | Fields whose values you want to get (views, views_by_type, detail) | Yes |
Description of response parameters:
Parameter name | Description |
---|---|
status | Response status (Completed, Unauthorized, Forbidden, Error) |
description | Description of the response status |
result | Main response information |
account | Account name |
stream | Stream |
views | Number of viewers |
views_by_type | Number of viewers by type of view |
detail | Viewers detailed information |
IpAddress | Viewer's IP address |
UserAgent | Viewer's useragent |
UserId | Viewer's ID |
ViewType | Type of view |
Possible response codes:
Response code | Description |
---|---|
200 | OK |
400 | Bad request |
401 | Unauthorized |
403 | Forbidden |
500 | Internal Server Error |
503 | Service Unavailable |
Total data
This method is used to get total information about stream views at current time.
URL: https://api-cdn.platformcraft.com/app/activesessions/v1/streams
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/activesessions/v1/streams?account=testaccount'
Successful response example
{ "status": "Completed", "description": "Success", "account": [ "testaccount" ], "fields": [ "account", "stream", "views", "views_by_type" ], "result": [ { "account": "testaccount", "stream": "test/_definst_/360p_test.sdp", "views_by_type": { "HLS": 8 }, "views": 8 }, { "account": "testaccount", "stream": "test/_definst_/720p_test.sdp", "views_by_type": { "HLS": 7 }, "views": 7 } ] }
Detailed data
This method is used to get detailed information about stream views at current time.
URL: https://api-cdn.platformcraft.com/app/activesessions/v1/streams?account=<your_account_name>&fields=detail
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/activesessions/v1/streams?account=testaccount&fields=detail'
Successful response example
{ "status": "Completed", "description": "Success", "account": [ "testaccount" ], "fields": [ "account", "detail", "stream" ], "result": [ { "account": "testaccount", "stream": "test/_definst_/360p_test.sdp", "detail": [ { "IpAddress": "84.142.236.203", "UserAgent": "samsunghas-agent/1.1", "UserId": "eec0c296479e296658e4d2b78ctestb0", "ViewType": "HLS" }, { "IpAddress": "85.246.51.121", "UserAgent": "HLS Client/2.0 (compatible; LG NetCast.TV-2012)", "UserId": "64f3c932ebc77cdtestaada7665d657d", "ViewType": "HLS" } ] } ] }
API image optimization statistic
General information
This method is used to get statistics on image optimization usage.
Warning!
- There is a limit on the number of API calls:
- no more than 5 requests per minute.
Description of request headers:
Headers name | Description | Required |
---|---|---|
CDN-AUTH-TOKEN | Authorization Token | yes |
Description of request parameters:
Parameter name | Description | Required |
---|---|---|
account | Account name | yes |
fields | Fields whose values you want to return | no |
start | Start of interval in ISO 8601 (inclusive) | yes |
end | End of interval in ISO 8601 (not inclusive) | yes |
granularity | Simplified ISO 8601 time duration (P1D, PT8H,...) | for /times |
sort | Object and sorting method | No |
offset | Result bias | No |
limit | Result limitation | No |
resource | Resource Identifier | No |
Description of response parameters:
Parameter | Description |
---|---|
start, end | Time range of report |
account | Account name |
data | Report |
conversions | Number of operations |
requests | Number of requests |
in_bytes | Inbound traffic in bytes |
out_bytes | Outbound traffic in bytes |
in_content_type | Content-Type of initial request |
out_content_type | Content-Type of processed request |
Possible response codes:
Response code | Response data |
---|---|
200 | OK |
400 | Invalid request |
401 | Token is invalid |
403 | Forbidden |
500 | Internal Server Error |
503 | Service Unavailable |
Summary
This method is used to get summary image optimization usage statistics
URL: https://api-cdn.platformcraft.com/app/ioss-statistic/v1/?account=<your_account_name>&start=2023-01-01T00:00:00Z&end=2023-02-01T00:00:00Z
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/ioss-statistic/v1/?account=testaccount&start=2023-01-02T13:09:00Z&end=2023-03-02T13:10:00Z'
Success Response Example
{ "end": "2023-03-02T13:10:00+00:00", "start": "2023-01-02T13:09:00+00:00", "account": "testaccount", "data": { "conversions": 27585497, "requests": 21921555, "in_bytes": 2443059563686, "out_bytes": 1330836800409 } }
Statistics by resource
This method is used to get image optimization usage statistics for a given period by account resources.
URL: https://api-cdn.platformcraft.com/app/ioss-statistic/v1/resources?account=<your_account_name>&start=2023-01-01T00:00:00Z&end=2023-02-01T00:00:00Z
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/ioss-statistic/v1/resources?account=testaccount&start=2023-01-02T13:09:00Z&end=2023-03-02T13:10:00Z'
Пример успешного ответа
{ "end": "2023-03-02T13:10:00+00:00", "start": "2023-01-02T13:09:00+00:00", "account": "testaccount", "data": [ { "resource": "testresource1_id", "resource_name": "testresource1", "conversions": 14601185, "requests": 13412331, "in_bytes": 1615409385151, "out_bytes": 983457015345 }, { "resource": "testresource2_id", "resource_name": "testresource2", "conversions": 12984312, "requests": 8509224, "in_bytes": 827650178535, "out_bytes": 347379785064 } ] }
Actions statistics
This method is used to get detail report by type of operation
URL: https://api-cdn.platformcraft.com/app/ioss-statistic/v1/action?account=<your_account_name>&start=2023-01-01T00:00:00Z&end=2023-02-01T00:00:00Z
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/ioss-statistic/v1/action?account=testaccount&start=2023-01-02T13:09:00Z&end=2023-03-02T13:10:00Z'
Success Response Example
{ "start": "2023-01-02T13:09:00+00:00", "end": "2023-03-02T13:10:00+00:00", "account": "testaccount", "data": [ { "action": "convert", "conversions": 21913945, "in_bytes": 2265285030613, "out_bytes": 344728920647 }, { "action": "quality", "conversions": 5671552, "in_bytes": 597323275534, "out_bytes": 90913935289 } ] }
Content-Type statistics
This methods are used to get detail report by in/out content-type
URL: https://api-cdn.platformcraft.com/app/ioss-statistic/v1/in-content-type?account=<your_account_name>&start=2023-01-01T00:00:00Z&end=2023-02-01T00:00:00Z
URL: https://api-cdn.platformcraft.com/app/ioss-statistic/v1/out-content-type?account=<your_account_name>&start=2023-01-01T00:00:00Z&end=2023-02-01T00:00:00Z
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/ioss-statistic/v1/out-content-type?account=testaccount&start=2023-02-02T13:09:00Z&end=2023-03-02T13:10:00Z'
Success Response Example
{ "start": "2023-02-02T13:09:00+00:00", "end": "2023-03-02T13:10:00+00:00", "account": "testaccount", "data": [ { "out_content_type": "-", "requests": 3120, "in_bytes": 594164, "out_bytes": 697806 }, { "out_content_type": "image/gif", "requests": 969, "in_bytes": 25855686, "out_bytes": 25855788 }, { "out_content_type": "image/jpeg", "requests": 4131912, "in_bytes": 333206022458, "out_bytes": 333188803602 }, { "out_content_type": "image/png", "requests": 1629595, "in_bytes": 504203255765, "out_bytes": 504147453203 }, { "out_content_type": "image/webp", "requests": 7995946, "in_bytes": 839899400734, "out_bytes": 128330988195 }, { "out_content_type": "text/html", "requests": 1378330, "in_bytes": 1725130740, "out_bytes": 1206975546 }, { "out_content_type": "text/plain; charset=utf-8", "requests": 13, "in_bytes": 2509, "out_bytes": 2951 } ] }
Statistics divided by period
This method is used to generate statistics with parameters divided by time period.
URL: https://api-cdn.platformcraft.com/app/ioss-statistic/v1/times/action?account=<your_account_name>&start=2023-01-01T00:00:00Z&end=2023-02-01T00:00:00Z&granularity=P1W'
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" \ 'https://api-cdn.platformcraft.com/app/ioss-statistic/v1/times/action?account=testaccount&start=2023-02-02T13:09:00Z&end=2023-03-02T13:10:00Z&granularity=P1W'
Success Response Example
{ "granularity": "P1W", "start": "2023-02-02T13:09:00+00:00", "end": "2023-03-02T13:10:00+00:00", "account": "testaccount", "data": [ { "start": "2023-02-02T13:09:00+00:00", "end": "2023-02-06T00:00:00+00:00", "data": [ { "action": "quality", "conversions": 0, "in_bytes": 0, "out_bytes": 0 }, { "action": "convert", "conversions": 727108, "in_bytes": 72033704597, "out_bytes": 11632136623 } ] }, {...}, { "start": "2023-02-27T00:00:00+00:00", "end": "2023-03-02T13:10:00+00:00", "data": [ { "action": "quality", "conversions": 987410, "in_bytes": 108687891902, "out_bytes": 16025891848 }, { "action": "convert", "conversions": 987410, "in_bytes": 108687891902, "out_bytes": 16025891848 } ] } ] }
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 | Deprecated, always "-" (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.cdn.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-cdn.platformcraft.com/app/logs/v1/accounts/<your_account_name>/exists?startdate=<start_date>&enddate=<end_date>
- Method: GET
- Headers: CDN-AUTH-TOKEN
- Required GET-parameters:
- startdate — the interval start date and time in format
YYYY-MM-DDTHH:mm:ssZ
- enddate — the interval end date and time in format
YYYY-MM-DDTHH:mm:ssZ
- startdate — the interval start date and time in format
- 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: $TOKEN" \ 'https://api-cdn.platformcraft.com/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-cdn.platformcraft.com/app/logs/v1/accounts/<your_account_name>/get?startdate=<start_date>&enddate=<end_date>
- Method: GET
- Headers: CDN-AUTH-TOKEN
- Required GET-parameters:
- startdate — the interval start date and time in format
YYYY-MM-DDTHH:mm:ssZ
- enddate — the interval end date and time in format
YYYY-MM-DDTHH:mm:ssZ
- startdate — the interval start date and time in format
- 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: $TOKEN" \ 'https://api-cdn.platformcraft.com/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 above.