Datacenter & ISP Proxies
数据中心和 ISP 代理的操作
获取订单中的活动代理
https://user-api.shardx.com/user/api/proxies/activeBearer authentication header of the form Bearer <token>.
200代理列表application/json
dataobject · ActiveProxyItem[]requiredShow propertiesHide properties
ISO8601/字符串日期
p0f 分配给IP的签名,不设置时为空
400订单尚无代理凭据(Missing authtoken in order)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
403此订单无法使用该方法application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
502代理提供商不可用或返回错误(Upstream error: <status>)application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/proxies/active?order_id=1GET /user/api/proxies/active?order_id=1 HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/proxies/active?order_id=1' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/proxies/active"
params = {
"order_id": "1",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/proxies/active?order_id=1";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/proxies/active?order_id=1"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/proxies/active?order_id=1")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/proxies/active?order_id=1");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/proxies/active?order_id=1");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"data": [
{
"ip": "text",
"username": "text",
"password": "text",
"http_port": 1,
"socks_port": 1,
"until": "text",
"status": "text",
"signature": "text"
}
],
"order_tag": "text"
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}设置按 IP 删除 (del-np)
https://user-api.shardx.com/user/api/orders/{order_id}/del-np/set仅适用于数据中心和 ISP 代理。
标记的代理在已付费周期结束前继续工作,并在下次续订时删除。订单的 quantity 和 price_paid 现在不会改变:续订时按剩余代理收费(订单价格的相应比例),然后再更新这两个字段。见 GET /user/api/orders/{order_id} 中的 renewal_quantity 和 renewal_price。
Bearer authentication header of the form Bearer <token>.
itemsobject[]requiredShow propertiesHide properties
200成功application/json
400验证错误/不是 DC-ISP/keep=0application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/orders/1/del-np/setPOST /user/api/orders/1/del-np/set HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"items": [
{
"ip": "text",
"value": true
}
]
}curl -X POST 'https://user-api.shardx.com/user/api/orders/1/del-np/set' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"items":[{"ip":"text","value":true}]}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/del-np/set"
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"items": [
{
"ip": "text",
"value": True,
},
],
}
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/orders/1/del-np/set";
const payload = {
"items": [
{
"ip": "text",
"value": true
}
]
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/orders/1/del-np/set"
body := bytes.NewBufferString(`{
"items": [
{
"ip": "text",
"value": true
}
]
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/orders/1/del-np/set")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"items": [
{
"ip": "text",
"value": true
}
]
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/orders/1/del-np/set");
request.Content = new StringContent("""
{
"items": [
{
"ip": "text",
"value": true
}
]
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"items": [
{
"ip": "text",
"value": true
}
]
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/del-np/set");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "text"
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}设置 IP 操作系统指纹
https://user-api.shardx.com/user/api/orders/{order_id}/signature/set为一个或多个代理 IP 设置操作系统指纹签名。
订单必须启用 p0f_slots 组件。
每个设置了签名的 IP 会永久占用一个槽位。修改已有签名 IP 的操作系统值不会占用额外槽位。
可用的签名值:
| 值 | 操作系统 |
|---|---|
ios | iOS |
macos | macOS |
android | Android |
linux | Linux |
win10 | Windows 10 |
win11 | Windows 11 |
Bearer authentication header of the form Bearer <token>.
itemsobject[]requiredShow propertiesHide properties
要欺骗的操作系统标识符。
iosmacosandroidlinuxwin10win11200成功application/json
更新的IP数量
400验证错误或插槽不足application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/orders/1/signature/setPOST /user/api/orders/1/signature/set HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"items": [
{
"ip": "text",
"signature": "ios"
}
]
}curl -X POST 'https://user-api.shardx.com/user/api/orders/1/signature/set' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"items":[{"ip":"text","signature":"ios"}]}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/signature/set"
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"items": [
{
"ip": "text",
"signature": "ios",
},
],
}
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/orders/1/signature/set";
const payload = {
"items": [
{
"ip": "text",
"signature": "ios"
}
]
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/orders/1/signature/set"
body := bytes.NewBufferString(`{
"items": [
{
"ip": "text",
"signature": "ios"
}
]
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/orders/1/signature/set")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"items": [
{
"ip": "text",
"signature": "ios"
}
]
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/orders/1/signature/set");
request.Content = new StringContent("""
{
"items": [
{
"ip": "text",
"signature": "ios"
}
]
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"items": [
{
"ip": "text",
"signature": "ios"
}
]
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/signature/set");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "text",
"updated": 1
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}计算附加成本
https://user-api.shardx.com/user/api/orders/{order_id}/addons/calculate返回为活动数据中心/ISP 订单购买给定附加组件的额外单位的价格预览。目前唯一支持的附加密钥是 p0f_slots;操作系统指纹签名槽。
Bearer authentication header of the form Bearer <token>.
订单号
附加标识符(例如 p0f_slots)
要添加的单位数量
200价格预览application/json
每单位价格(美分)
本次购买的总费用(以美分为单位)
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/orders/1/addons/calculate?addon_key=text&add_qty=1GET /user/api/orders/1/addons/calculate?addon_key=text&add_qty=1 HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.shardx.com/user/api/orders/1/addons/calculate?addon_key=text&add_qty=1' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/addons/calculate"
params = {
"addon_key": "text",
"add_qty": "1",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.get(url, params=params, headers=headers, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/orders/1/addons/calculate?addon_key=text&add_qty=1";
const response = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
},
});
console.log(response.status);
console.log(await response.text());package main
import (
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/orders/1/addons/calculate?addon_key=text&add_qty=1"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.get("https://user-api.shardx.com/user/api/orders/1/addons/calculate?addon_key=text&add_qty=1")
.header("Authorization", format!("Bearer {token}"))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Get, "https://user-api.shardx.com/user/api/orders/1/addons/calculate?addon_key=text&add_qty=1");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/addons/calculate?addon_key=text&add_qty=1");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"addon_key": "text",
"catalog_id": 1,
"price_per_unit": 1,
"current_qty": 1,
"add_qty": 1,
"new_qty": 1,
"add_total": 1
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}购买附加组件
https://user-api.shardx.com/user/api/orders/{order_id}/addons/purchase立即从钱包扣款,并将指定数量的组件添加到订单。订单状态必须为 active。目前只有 p0f_slots 可用。
请发送 Idempotency-Key 标头,确保重试安全(会扣款)。
Bearer authentication header of the form Bearer <token>.
订单号
可选。逻辑操作的唯一标识符(1–128 个 [A-Za-z0-9_.:-] 字符),例如 UUID。
重试结果未知的请求(超时、连接中断)时,请发送相同的键:已完成的请求不会再次执行,而是返回其原始响应。
本 API 的所有修改类端点(POST/PUT/PATCH/DELETE)都接受此标头:购买、续订、追加流量、组件以及今后新增的端点;涉及扣款的端点会明确列出。
除子用户操作外的所有端点:保存的响应会在 7 天内带 `Idempotency-Replayed: true` 标头重放。`409`:使用此键的请求仍在执行(`idempotency_state: in_progress`),或未完成且需要人工核实结果(`idempotency_state: unknown`;不会再次执行)。`422`:该键已用于另一个请求。限流返回的 `429` 不会消耗该键,请使用同一个键重试。
子用户端点(创建、data/add、data/subtract):该键会转发给代理提供商,24 小时内重试不会两次修改配额。409:操作仍在进行,或该键已用于不同的数据。
不带此标头时,请求照常执行,但没有上述保障。
200已购买附加组件application/json
该订单的累计附加成本(分)
addonsobject · AddonLine[]optional订单中存储的更新附加列表
Show propertiesHide properties
订单中存储的更新附加列表
当期活跃单位
购买时的单价(以美分为单位)
pendingobject· nullableoptional更改计划下次续订,或 null
Show propertiesHide properties
更改计划下次续订,或 null
canceldowngrade降级后目标数量
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
409该订单的组件同时发生了另一项更改(请重试),或使用此 Idempotency-Key 的请求仍在执行application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
422该 Idempotency-Key 已用于另一个请求application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/orders/1/addons/purchasePOST /user/api/orders/1/addons/purchase HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Idempotency-Key: text
Content-Type: application/json
Accept: */*
{
"addon_key": "text",
"add_qty": 1
}curl -X POST 'https://user-api.shardx.com/user/api/orders/1/addons/purchase' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Idempotency-Key: text' \
-H 'Content-Type: application/json' \
-d '{"addon_key":"text","add_qty":1}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/addons/purchase"
headers = {
"Authorization": f"Bearer {token}",
"Idempotency-Key": "text",
}
payload = {
"addon_key": "text",
"add_qty": 1,
}
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/orders/1/addons/purchase";
const payload = {
"addon_key": "text",
"add_qty": 1
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Idempotency-Key": "text",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/orders/1/addons/purchase"
body := bytes.NewBufferString(`{
"addon_key": "text",
"add_qty": 1
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Idempotency-Key", "text")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/orders/1/addons/purchase")
.header("Authorization", format!("Bearer {token}"))
.header("Idempotency-Key", "text")
.json(&serde_json::json!({
"addon_key": "text",
"add_qty": 1
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/orders/1/addons/purchase");
request.Headers.Add("Idempotency-Key", "text");
request.Content = new StringContent("""
{
"addon_key": "text",
"add_qty": 1
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Idempotency-Key: text");
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"addon_key": "text",
"add_qty": 1
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/addons/purchase");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "text",
"addons_price_paid": 1,
"addons": [
{
"addon_key": "text",
"catalog_id": 1,
"qty": 1,
"price_per_unit": 1,
"pending": {
"action": "cancel",
"next_qty": 1
}
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}安排附加降级
https://user-api.shardx.com/user/api/orders/{order_id}/addons/schedule安排组件在下一个续订周期 降级。新数量必须低于当前数量。更改保存为 pending 标记,并在订单续订时自动应用。
Bearer authentication header of the form Bearer <token>.
订单号
downgrade:下次续订时减少数量;cancel:下次续订时移除该组件
downgradecanceldowngrade 时必填:续订后的数量,须小于当前数量(0 表示移除全部单位)
200已安排降级application/json
addonsobject · AddonLine[]optionalShow propertiesHide properties
当期活跃单位
购买时的单价(以美分为单位)
pendingobject· nullableoptional更改计划下次续订,或 null
Show propertiesHide properties
更改计划下次续订,或 null
canceldowngrade降级后目标数量
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
404订单不存在application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/orders/1/addons/schedulePOST /user/api/orders/1/addons/schedule HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"addon_key": "text",
"action": "downgrade",
"next_qty": 1
}curl -X POST 'https://user-api.shardx.com/user/api/orders/1/addons/schedule' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"addon_key":"text","action":"downgrade","next_qty":1}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/addons/schedule"
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"addon_key": "text",
"action": "downgrade",
"next_qty": 1,
}
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/orders/1/addons/schedule";
const payload = {
"addon_key": "text",
"action": "downgrade",
"next_qty": 1
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/orders/1/addons/schedule"
body := bytes.NewBufferString(`{
"addon_key": "text",
"action": "downgrade",
"next_qty": 1
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/orders/1/addons/schedule")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"addon_key": "text",
"action": "downgrade",
"next_qty": 1
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/orders/1/addons/schedule");
request.Content = new StringContent("""
{
"addon_key": "text",
"action": "downgrade",
"next_qty": 1
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"addon_key": "text",
"action": "downgrade",
"next_qty": 1
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/addons/schedule");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "text",
"addons": [
{
"addon_key": "text",
"catalog_id": 1,
"qty": 1,
"price_per_unit": 1,
"pending": {
"action": "cancel",
"next_qty": 1
}
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}取消已安排的降级
https://user-api.shardx.com/user/api/orders/{order_id}/addons/schedule/cancel取消通过 schedule 接口设置的待处理降级。
Bearer authentication header of the form Bearer <token>.
订单号
200待降级已清除application/json
addonsobject · AddonLine[]optionalShow propertiesHide properties
当期活跃单位
购买时的单价(以美分为单位)
pendingobject· nullableoptional更改计划下次续订,或 null
Show propertiesHide properties
更改计划下次续订,或 null
canceldowngrade降级后目标数量
400请求无效;原因见 message。大多数校验返回 JSON(ApiError),少数返回纯文本(Content-Type: text/plain):Invalid proxy type、User don't have active order with this proxy type、User resident not set for user(住宅代理端点),Addon not available for this product、Invalid addons_json 以及组件数量校验(组件端点、带组件的购买和计算),还有代理服务器在 signature/set 和 del-np/set 中返回的错误。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
401缺少 API 密钥或密钥无效:Missing or invalid Authorization header、Invalid API key、API key mismatchapplication/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
500内部错误。当订单(或所需的其他记录)不存在或不属于您的账户时,API 同样返回 500;具体原因见 message,例如 Order not found。application/json
子用户操作:提供商拒绝了该操作且未发生任何更改时为 true
仅出现在 Idempotency-Key 校验返回的 409 中
in_progressunknown仅出现在购买和 add-bandwidth 返回的 502 中:已付款的订单
仅出现在购买和 add-bandwidth 返回的 502 中:true 表示款项已退回钱包,false 表示退款尚未完成,请联系支持
/user/api/orders/1/addons/schedule/cancelPOST /user/api/orders/1/addons/schedule/cancel HTTP/1.1
Host: user-api.shardx.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"addon_key": "text"
}curl -X POST 'https://user-api.shardx.com/user/api/orders/1/addons/schedule/cancel' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"addon_key":"text"}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.shardx.com/user/api/orders/1/addons/schedule/cancel"
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"addon_key": "text",
}
response = requests.post(url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.status_code)
print(response.text)// API token — see Authorizations above.
const token = "YOUR_SECRET_TOKEN";
const url = "https://user-api.shardx.com/user/api/orders/1/addons/schedule/cancel";
const payload = {
"addon_key": "text"
};
const response = await fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(response.status);
console.log(await response.text());package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
)
func main() {
// API token — see Authorizations above.
token := "YOUR_SECRET_TOKEN"
url := "https://user-api.shardx.com/user/api/orders/1/addons/schedule/cancel"
body := bytes.NewBufferString(`{
"addon_key": "text"
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Status)
fmt.Println(string(out))
}// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }, tokio = { version = "1", features = ["full"] }, serde_json = "1"
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// API token — see Authorizations above.
let token = "YOUR_SECRET_TOKEN";
let client = reqwest::Client::new();
let response = client
.post("https://user-api.shardx.com/user/api/orders/1/addons/schedule/cancel")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"addon_key": "text"
}))
.send()
.await?;
println!("{}", response.status());
println!("{}", response.text().await?);
Ok(())
}using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// API token — see Authorizations above.
var token = "YOUR_SECRET_TOKEN";
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var request = new HttpRequestMessage(HttpMethod.Post, "https://user-api.shardx.com/user/api/orders/1/addons/schedule/cancel");
request.Content = new StringContent("""
{
"addon_key": "text"
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}// build: c++ -std=c++17 main.cpp -lcurl
#include <curl/curl.h>
#include <iostream>
#include <string>
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata) {
static_cast<std::string *>(userdata)->append(ptr, size * nmemb);
return size * nmemb;
}
int main() {
// API token — see Authorizations above.
const std::string token = "YOUR_SECRET_TOKEN";
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
std::cerr << "curl_easy_init failed\n";
curl_global_cleanup();
return 1;
}
struct curl_slist *headers = nullptr;
headers = curl_slist_append(headers, ("Authorization: Bearer " + token).c_str());
headers = curl_slist_append(headers, "Content-Type: application/json");
const std::string body = R"json({
"addon_key": "text"
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.shardx.com/user/api/orders/1/addons/schedule/cancel");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
const CURLcode rc = curl_easy_perform(curl);
if (rc != CURLE_OK) {
std::cerr << curl_easy_strerror(rc) << "\n";
} else {
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
std::cout << status << "\n" << response << "\n";
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl_global_cleanup();
return rc == CURLE_OK ? 0 : 1;
}{
"success": true,
"message": "text",
"addons": [
{
"addon_key": "text",
"catalog_id": 1,
"qty": 1,
"price_per_unit": 1,
"pending": {
"action": "cancel",
"next_qty": 1
}
}
]
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}{
"success": true,
"message": "text",
"rejected": true,
"idempotency_state": "in_progress",
"order_id": 1,
"refunded": true
}最后更新