自动补充
删除带宽规则
删除一条带宽自动补充规则
DELETE
/
api
/
v1
/
bandwidth
/
auto-refill
/
{rule_id}
删除带宽规则
curl --request DELETE \
--url https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}import requests
url = "https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body{
"status": "<string>"
}删除带宽规则
删除一条规则。该规则不再进行任何补充,该地址也可以重新用于新的带宽规则。已购买的带宽不会被收回:这些租赁会持续到其租期结束。以往的补充订单会保留在您的订单历史中。需要buy_bandwidth 权限。
如果只想暂时停止补充而不丢失规则,请改为暂停规则。
路径参数
number
必填
规则 ID——创建或列出带宽规则时返回的
id响应
string
ok示例
curl -X DELETE https://api.tronrental.com/v1/bandwidth/auto-refill/15 \
-H "X-API-Key: your_api_key"
import requests
resp = requests.delete(
"https://api.tronrental.com/v1/bandwidth/auto-refill/15",
headers={"X-API-Key": "your_api_key"},
)
print(resp.json())
const resp = await fetch("https://api.tronrental.com/v1/bandwidth/auto-refill/15", {
method: "DELETE",
headers: { "X-API-Key": "your_api_key" },
});
console.log(await resp.json());
Response
{
"status": "ok"
}
错误
| 状态 | 代码 | 触发条件 |
|---|---|---|
403 | FORBIDDEN | API 密钥缺少 buy_bandwidth 权限 |
404 | NOT_FOUND | 您的账户中没有此 ID 的带宽规则(或已被删除) |
409 | AUTOREFILL_IN_PROGRESS | 该规则的一次补充正在购买中——请一分钟后重试 |
{
"detail": {
"error": {
"code": "NOT_FOUND",
"message": "Auto-refill rule not found"
}
}
}
⌘I
删除带宽规则
curl --request DELETE \
--url https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}import requests
url = "https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/bandwidth/auto-refill/{rule_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body{
"status": "<string>"
}