百度智能云

All Product Document

          CDN

          Set the Domain Name Speed Limit

          Interface

          This interface is used to set the domain name rate limit. (Single link speed limit).

          Method Path Description
          PUT /v2/domain/{domain}/config?trafficLimit Set rate limit for a single link

          domain: Modify the configured CDN acceleration domain name.

          Request body

          Parameter Optional Type Description
          trafficLimit Required trafficLimit Speed limit information

          trafficLimitType description

          Parameter Optional Type Description
          enable Required bool Whether to enable rate limit.
          limitRate Required int Required when the speed limit is enabled, in Byte/s
          limitStartHour Optional int Time to start speed limit. Please enter a number within the range 0-24. It is smaller than the time to end speed limit, and the default is 0.
          limitEndHour Optional int Time to end speed limit. Please enter a number within the range 0-24. It is greater than the time to end speed limit, and the default is 24.
          limitRateAfter Optional int Speed limitation after sending how much data, with the unit of Byte.
          trafficLimitArg Optional string Name of the rate limit parameter, limit rate based on the arg extracted from the url, such as rate (higher priority than limitRate.
          trafficLimitUnit Optional string Unit of speed limit parameter, which supports m, k and g, and it defaults to be Byte.

          Note
          Cross-day and multiple timeline settings are not supported.

          Response code (Http Status Code)

          HTTP Status Code Description
          200 Success
          400 Update failures, parameter errors, etc.

          Request example

          PUT /v2/domain/1.test.com/config?trafficLimit HTTP/1.1 
          Host: cdn.baidubce.com 
          Accept: */* 
          Content-Length: 77
          Content-Type: application/x-www-form-urlencoded
           
           
          { 
              "trafficLimit":{ 
                  "enable":true, 
                  "limitRate":10485760, 
                  "limitStartHour":10, 
                  "limitEndHour":19, 
                  "limitRateAfter":0, 
                  "trafficLimitArg":"rate", 
                  "trafficLimitUnit":"m" 
              } 
          } 

          Response example

          HTTP/1.1 200 OK 
          Server: nginx 
          Date: Wed, 26 Jun 2019 05:53:37 GMT 
          Content-Type: application/json; charset=utf-8 
          Transfer-Encoding: chunked 
          Connection: keep-alive 
          X-Powered-By: PHP/7.1.5 
          x-bce-request-id: d5dd86a5-ed92-6d3-963d-b72c82a5a4ff
          
          {"status":"RUNNING"} 
          Previous
          Query Cors Cross-domain
          Next
          Query Domain Name Speed Limit