Local Storage

GetDomainUsage

Update time: 2025-07-05 10:45:49

This interface is used to query local storage usage data for a specified domain in the East 9th time zone. Users need to provide the query time range, domain name, and contract information. The returned results include usage data for the domain corresponding to each timestamp, which helps users monitor local storage usage data for the domain, facilitating resource planning and cost management.

  • Limit of request rate per user: 300/5min
  • Applicable Products: Local Storage
For API authentication details, please refer to: API Authentication Overview

Request

Body Params

NameDescription
*dateFromString

Start time 1.The format is yyyy-MM-dd; 2.And smaller than the current time and 'dateTo'; 3.Only the data of the last 2 years can be queried.4.Period between dataFrom and dateTo should not be longer than 31 days

*dateToString

End time 1.The format is yyyy-MM-dd; 2.Must be greater than 'dateFrom'; 3.If it's greater than the current time, then the current time is assigned as the value.

*domainString

Domain. Only support send one domain at a time

*contractString

contract that the domain belong, only support send one contract at a time

typeString

Data granularity

h: hourly

d: daily

If not specified, daily is set as the default value

Response

Body Params

NameDescription
domainString

Domain

usageList
timestampString

DateTime, the format is yyyy-MM-dd HH:mm

usageString

Usage,the unit is byte

Error code

Error code(code)Description(message)HTTP statusSemantic
24102006

The date specified is invalid.

400The date specified is invalid.
24102021

Date format error.

400Date format error.
24102008

param: domain is null or invalid.

400param: domain is null or invalid.
24102500

We encountered an internal error. Please try again.

500We encountered an internal error. Please try again.
24102023

Failed to get ids. Please check the domain.

400Failed to get ids. Please check the domain.
24102023

Invalid parameters. Please check the 'contract' or 'dateFrom' or 'dateTo'.

400Invalid parameters. Please check the 'contract' or 'dateFrom' or 'dateTo'.
34102022

No contract permission

400No contract permission
24102008

Domain not found

400Domain not found

Example

JSON
JSON
Request example
Copy Copy success
#!/bin/bash
# Please remember to change the param (-H "X-Time-Zone") in this demo to the TimeZone you want in response
username='example_username'
apiKey='example_apiKey'
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://api.cdnetworks.com/api/domain-usage" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '{"dateFrom":"2022-08-01","dateTo":"2022-08-05","domain":"edu.xxx.net","contract":"xxxxxx-xxx","type":"d"}'
Response example
Copy Copy success
{
  "code": "0",
  "message": "success",
  "data": [
    {
      "timestamp": "2022-08-01",
      "usage": "2135"
    },
    {
      "timestamp": "2022-08-02",
      "usage": "2135"
    },
    {
      "timestamp": "2022-08-03",
      "usage": "2141"
    },
    {
      "timestamp": "2022-08-04",
      "usage": "2141"
    },
    {
      "timestamp": "2022-08-05",
      "usage": "2141"
    }
  ]
}
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!