All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

BlockDomainUrl

Last updated:2021-03-17 10:56:37

BlockDomainUrl

Description

You can call this operation to block or unblock URLs.

Notes:

  • A URL blocking quota is specified for each account ID and is shared with the Kingsoft Cloud CDN console. You can query the quota in the Kingsoft Cloud CDN console or by calling the GetBlockUrlQuota operation. Blocking fails when the number of blocked URLs exceeds the upper limit.

  • When you attempt to access a blocked URL, the HTTP status code 403 is returned.

  • After a URL is unblocked, access to the URL is resumed.

Limits:

  • If you unblock a URL that does not exist or has been unblocked, a success message is returned.

  • All URLs must start with http://. Both HTTP access and HTTPS access are disabled for the specified URLs.

  • Each URL can be up to 1,000 characters in length.

  • All URLs must belong to the domain names that have been added to Kingsoft Cloud CDN for accelerated content delivery.

  • Chinese characters in URLs must be URL-encoded.

  • You can block or unblock up to 1,000 URLs at a time.

  • This operation supports only the POST request method.

Request syntax

The API request contains the specified directory /2016-09-01/content/BlockDomainUrl, common request headers, and operation-specific request parameters. For more information, see the sample request.

Request parameters

Parameter Type Required Description
BlockType String Yes The type of the operation. Valid values: block and unblock.
Urls Url[] Yes The URLs.
BlockTime Long No The blocking period. Unit: seconds. This parameter takes effect only when the BlockType parameter is set to block. The period ranges from 1 hour to 31 days. Default value: 604800 (7 days). The URLs are automatically unblocked when the blocking period ends. Note: In the current version, you can set this parameter, but the setting does not take effect. The default value (7 days) is used. This issue will be fixed in the next version.
RefreshOnUnblock String No Specifies whether to trigger refreshing after unblocking. This parameter takes effect only when the BlockType parameter is set to unblock. Valid values: on and off. Default value: off.

Url

Parameter Type Description
Url String The specified URL, which starts with http://. Both HTTP access and HTTPS access are disabled.

Response parameters

None

Special error codes

Error code Error message Description
IllegalOperation Illegal domain operate is not permitted. The error message returned because you are not authorized to perform this operation.
QuotaOverfull The error message returned because the quota runs out.

Examples

Sample request

POST method:

POST /2016-09-01/content/BlockDomainUrl
Host: cdn.api.ksyun.com 
X-Amz-Date: date  
Authorization:authorization string 
x-action: BlockDomainUrl
x-version: 2016-09-01 
 Content-Type: application/json

{
    "DomainId": "2D08M8V",
    "BlockType":"block",
    "BlockTime":3600,
    "Urls":[{"Url":"http://www.test.com/abc.txt"},
    {"Url":"http://www.test.com/txa.txt"}]
}

Sample response

  • Note: If this operation is successfully called, the HTTP status code 200 is returned, without a return value. If this operation fails to be called, the HTTP status code 403 or 400 is returned. For more information about the error codes for the HTTP status code 400, see Usage notes.
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback