Residential Proxies
住宅代理的操作
购买额外流量(住宅)
https://user-api.proxyshard.com/user/api/orders/{id}/add-bandwidthBearer authentication header of the form Bearer <token>.
容量(GB)
200成功的application/json
/user/api/orders/1/add-bandwidthPOST /user/api/orders/1/add-bandwidth HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"amount": 1,
"promo_code": "text"
}curl -X POST 'https://user-api.proxyshard.com/user/api/orders/1/add-bandwidth' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"amount":1,"promo_code":"text"}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/orders/1/add-bandwidth"
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"amount": 1,
"promo_code": "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.proxyshard.com/user/api/orders/1/add-bandwidth";
const payload = {
"amount": 1,
"promo_code": "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.proxyshard.com/user/api/orders/1/add-bandwidth"
body := bytes.NewBufferString(`{
"amount": 1,
"promo_code": "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.proxyshard.com/user/api/orders/1/add-bandwidth")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"amount": 1,
"promo_code": "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.proxyshard.com/user/api/orders/1/add-bandwidth");
request.Content = new StringContent("""
{
"amount": 1,
"promo_code": "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({
"amount": 1,
"promo_code": "text"
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.proxyshard.com/user/api/orders/1/add-bandwidth");
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": "Order paid successfully"
}账户所有者流量
https://user-api.proxyshard.com/user/api/proxies/profile返回给定代理类型的父账户自己的总数据和剩余数据,在父订单中聚合。与子用户端点不同,这反映了帐户所有者的数据,而不是子用户的数据。
Bearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
200成功application/json
分配的数据总量(以字节为单位)
剩余数据(以字节为单位)
消耗的数据(以字节为单位)
父帐户的代理密码
400用户驻留未设置/代理类型无效application/json
401未经授权application/json
/user/api/proxies/profile?proxy_type=textGET /user/api/proxies/profile?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.proxyshard.com/user/api/proxies/profile?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/profile"
params = {
"proxy_type": "text",
}
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.proxyshard.com/user/api/proxies/profile?proxy_type=text";
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.proxyshard.com/user/api/proxies/profile?proxy_type=text"
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.proxyshard.com/user/api/proxies/profile?proxy_type=text")
.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.proxyshard.com/user/api/proxies/profile?proxy_type=text");
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.proxyshard.com/user/api/proxies/profile?proxy_type=text");
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": 1,
"data_remain": 1,
"data_spent": 1,
"proxy_password": "text"
}{
"success": true,
"message": "text"
}{
"success": true,
"message": "text"
}子用户列表
https://user-api.proxyshard.com/user/api/proxies/sub-usersBearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
200成功的application/json
分页前子用户总数
dataobject[]optionalShow propertiesHide properties
/user/api/proxies/sub-users?proxy_type=textGET /user/api/proxies/sub-users?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.proxyshard.com/user/api/proxies/sub-users?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/sub-users"
params = {
"proxy_type": "text",
}
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.proxyshard.com/user/api/proxies/sub-users?proxy_type=text";
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.proxyshard.com/user/api/proxies/sub-users?proxy_type=text"
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.proxyshard.com/user/api/proxies/sub-users?proxy_type=text")
.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.proxyshard.com/user/api/proxies/sub-users?proxy_type=text");
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.proxyshard.com/user/api/proxies/sub-users?proxy_type=text");
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,
"count": 1,
"data": [
{
"user_id": "text",
"first_name": "text",
"proxy_password": "text",
"data": 1,
"data_spent": 1,
"data_remain": 1
}
]
}通过ID获取子用户
https://user-api.proxyshard.com/user/api/proxies/sub-user/{user_id}Bearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
200成功的application/json
dataobject[]optionalShow propertiesHide properties
/user/api/proxies/sub-user/text?proxy_type=textGET /user/api/proxies/sub-user/text?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/sub-user/text"
params = {
"proxy_type": "text",
}
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.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text";
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.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text"
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.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text")
.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.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text");
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.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text");
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": [
{
"first_name": "text",
"proxy_password": "text",
"data": 1,
"data_spent": 1
}
]
}删除子用户
https://user-api.proxyshard.com/user/api/proxies/sub-user/{user_id}Bearer authentication header of the form Bearer <token>.
200成功的application/json
/user/api/proxies/sub-user/textDELETE /user/api/proxies/sub-user/text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X DELETE 'https://user-api.proxyshard.com/user/api/proxies/sub-user/text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/sub-user/text"
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.delete(url, 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.proxyshard.com/user/api/proxies/sub-user/text";
const response = await fetch(url, {
method: "DELETE",
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.proxyshard.com/user/api/proxies/sub-user/text"
req, err := http.NewRequest("DELETE", 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
.delete("https://user-api.proxyshard.com/user/api/proxies/sub-user/text")
.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.Delete, "https://user-api.proxyshard.com/user/api/proxies/sub-user/text");
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.proxyshard.com/user/api/proxies/sub-user/text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
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,
"message": "Sub user deleted successfully"
}编辑子用户(名称/包)
https://user-api.proxyshard.com/user/api/proxies/sub-user/{user_id}Bearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
200成功的application/json
/user/api/proxies/sub-user/text?proxy_type=textPATCH /user/api/proxies/sub-user/text?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"name": "text"
}curl -X PATCH 'https://user-api.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"name":"text"}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/sub-user/text"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"name": "text",
}
response = requests.patch(url, params=params, 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.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text";
const payload = {
"name": "text"
};
const response = await fetch(url, {
method: "PATCH",
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.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text"
body := bytes.NewBufferString(`{
"name": "text"
}`)
req, err := http.NewRequest("PATCH", 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
.patch("https://user-api.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"name": "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.Patch, "https://user-api.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text");
request.Content = new StringContent("""
{
"name": "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({
"name": "text"
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.proxyshard.com/user/api/proxies/sub-user/text?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PATCH");
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": "Sub user edited successfully"
}创建子用户
https://user-api.proxyshard.com/user/api/proxies/sub-userBearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
200成功的application/json
dataobject[]optionalShow propertiesHide properties
/user/api/proxies/sub-user?proxy_type=textPOST /user/api/proxies/sub-user?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"name": "text",
"data": 1
}curl -X POST 'https://user-api.proxyshard.com/user/api/proxies/sub-user?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"name":"text","data":1}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/sub-user"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"name": "text",
"data": 1,
}
response = requests.post(url, params=params, 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.proxyshard.com/user/api/proxies/sub-user?proxy_type=text";
const payload = {
"name": "text",
"data": 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.proxyshard.com/user/api/proxies/sub-user?proxy_type=text"
body := bytes.NewBufferString(`{
"name": "text",
"data": 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.proxyshard.com/user/api/proxies/sub-user?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"name": "text",
"data": 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.proxyshard.com/user/api/proxies/sub-user?proxy_type=text");
request.Content = new StringContent("""
{
"name": "text",
"data": 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({
"name": "text",
"data": 1
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.proxyshard.com/user/api/proxies/sub-user?proxy_type=text");
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,
"data": [
{
"user_id": "text",
"first_name": "text",
"proxy_password": "text",
"data": 1,
"data_spent": 1
}
]
}给子用户添加流量
https://user-api.proxyshard.com/user/api/proxies/sub-user/{user_id}/data/addBearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
容量(GB)
200成功的application/json
/user/api/proxies/sub-user/text/data/add?proxy_type=textPOST /user/api/proxies/sub-user/text/data/add?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"data": 1
}curl -X POST 'https://user-api.proxyshard.com/user/api/proxies/sub-user/text/data/add?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"data":1}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/sub-user/text/data/add"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"data": 1,
}
response = requests.post(url, params=params, 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.proxyshard.com/user/api/proxies/sub-user/text/data/add?proxy_type=text";
const payload = {
"data": 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.proxyshard.com/user/api/proxies/sub-user/text/data/add?proxy_type=text"
body := bytes.NewBufferString(`{
"data": 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.proxyshard.com/user/api/proxies/sub-user/text/data/add?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"data": 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.proxyshard.com/user/api/proxies/sub-user/text/data/add?proxy_type=text");
request.Content = new StringContent("""
{
"data": 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({
"data": 1
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.proxyshard.com/user/api/proxies/sub-user/text/data/add?proxy_type=text");
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": "Traffic added to sub user successfully"
}扣除子用户流量
https://user-api.proxyshard.com/user/api/proxies/sub-user/{user_id}/data/subtractBearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
容量(GB)
200成功的application/json
/user/api/proxies/sub-user/text/data/subtract?proxy_type=textPOST /user/api/proxies/sub-user/text/data/subtract?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
{
"data": 1
}curl -X POST 'https://user-api.proxyshard.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"data":1}'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/sub-user/text/data/subtract"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
payload = {
"data": 1,
}
response = requests.post(url, params=params, 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.proxyshard.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text";
const payload = {
"data": 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.proxyshard.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text"
body := bytes.NewBufferString(`{
"data": 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.proxyshard.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text")
.header("Authorization", format!("Bearer {token}"))
.json(&serde_json::json!({
"data": 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.proxyshard.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text");
request.Content = new StringContent("""
{
"data": 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({
"data": 1
})json";
std::string response;
curl_easy_setopt(curl, CURLOPT_URL, "https://user-api.proxyshard.com/user/api/proxies/sub-user/text/data/subtract?proxy_type=text");
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": "Traffic subtracted from sub user successfully"
}修改子用户密码
https://user-api.proxyshard.com/user/api/proxies/sub-user/{user_id}/passwordBearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
200成功的application/json
/user/api/proxies/sub-user/text/password?proxy_type=textPOST /user/api/proxies/sub-user/text/password?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X POST 'https://user-api.proxyshard.com/user/api/proxies/sub-user/text/password?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/sub-user/text/password"
params = {
"proxy_type": "text",
}
headers = {
"Authorization": f"Bearer {token}",
}
response = requests.post(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.proxyshard.com/user/api/proxies/sub-user/text/password?proxy_type=text";
const response = await fetch(url, {
method: "POST",
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.proxyshard.com/user/api/proxies/sub-user/text/password?proxy_type=text"
req, err := http.NewRequest("POST", 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
.post("https://user-api.proxyshard.com/user/api/proxies/sub-user/text/password?proxy_type=text")
.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.Post, "https://user-api.proxyshard.com/user/api/proxies/sub-user/text/password?proxy_type=text");
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.proxyshard.com/user/api/proxies/sub-user/text/password?proxy_type=text");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
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,
"message": "Sub user password changed successfully"
}国家列表
https://user-api.proxyshard.com/user/api/proxies/countriesBearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
200成功的application/json
resultsobject · Country[]requiredShow propertiesHide properties
ISO国家代码
国家名称
/user/api/proxies/countries?proxy_type=textGET /user/api/proxies/countries?proxy_type=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.proxyshard.com/user/api/proxies/countries?proxy_type=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/countries"
params = {
"proxy_type": "text",
}
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.proxyshard.com/user/api/proxies/countries?proxy_type=text";
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.proxyshard.com/user/api/proxies/countries?proxy_type=text"
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.proxyshard.com/user/api/proxies/countries?proxy_type=text")
.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.proxyshard.com/user/api/proxies/countries?proxy_type=text");
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.proxyshard.com/user/api/proxies/countries?proxy_type=text");
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;
}{
"count": 1,
"results": [
{
"code": "text",
"name": "text"
}
]
}地区列表
https://user-api.proxyshard.com/user/api/proxies/regionsBearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
ISO国家代码
200成功的application/json
resultsobject · Region[]requiredShow propertiesHide properties
地区代码(州/省代码)
地区名称(州/省名称)
countryobject · CountryrequiredShow propertiesHide properties
ISO国家代码
国家名称
/user/api/proxies/regions?proxy_type=text&country_code=textGET /user/api/proxies/regions?proxy_type=text&country_code=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.proxyshard.com/user/api/proxies/regions?proxy_type=text&country_code=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/regions"
params = {
"proxy_type": "text",
"country_code": "text",
}
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.proxyshard.com/user/api/proxies/regions?proxy_type=text&country_code=text";
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.proxyshard.com/user/api/proxies/regions?proxy_type=text&country_code=text"
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.proxyshard.com/user/api/proxies/regions?proxy_type=text&country_code=text")
.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.proxyshard.com/user/api/proxies/regions?proxy_type=text&country_code=text");
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.proxyshard.com/user/api/proxies/regions?proxy_type=text&country_code=text");
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;
}{
"count": 1,
"results": [
{
"code": "text",
"name": "text",
"country": {
"code": "text",
"name": "text"
}
}
]
}城市列表
https://user-api.proxyshard.com/user/api/proxies/citiesBearer authentication header of the form Bearer <token>.
代理类型(标准 | 高级)
ISO国家代码
地区代码(州/省)
200成功的application/json
resultsobject · City[]requiredShow propertiesHide properties
城市代码(通常为 slug 格式)
城市名称
countryobject · CountryrequiredShow propertiesHide properties
ISO国家代码
国家名称
regionobject· nullableoptionalShow propertiesHide properties
地区代码
地区名称
/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=textGET /user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.proxyshard.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/cities"
params = {
"proxy_type": "text",
"country_code": "text",
"region_code": "text",
}
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.proxyshard.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text";
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.proxyshard.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text"
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.proxyshard.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text")
.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.proxyshard.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text");
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.proxyshard.com/user/api/proxies/cities?proxy_type=text&country_code=text®ion_code=text");
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;
}{
"count": 1,
"results": [
{
"code": "text",
"name": "text",
"country": {
"code": "text",
"name": "text"
},
"region": {
"code": "text",
"name": "text"
}
}
]
}列出 ISP
https://user-api.proxyshard.com/user/api/proxies/isps城市内可用的互联网提供商;继国家、地区、城市之后的第四个目标级别。与其他位置端点不同,这个端点需要完整的链:country_code、region_code 和 city_code 都是必需的,因为上游 ISP 与城市绑定。仅高级套餐:不为标准套餐和无限制套餐维护 ISP 目录,任何其他 proxy_type 都会被拒绝并返回 400。仅列出主要城市的 ISP,因此对于较小的城市,带有 count: 0 的空 results 是正常答案。
Bearer authentication header of the form Bearer <token>.
必须为 premium;ISP 定向仅适用于 premium 套餐。
premiumISO国家代码
地区或州代码
来自 GET /user/api/proxies/cities 的城市代码
200成功application/json
resultsobject · Isp[]requiredShow propertiesHide properties
ISP 代码,通常是一个 slug
互联网服务提供商名称
countryobject · CountryrequiredShow propertiesHide properties
ISO国家代码
国家名称
regionobject· nullableoptionalShow propertiesHide properties
地区代码
地区名称
400proxy_type 不是 `premium`,未设置用户常驻,或者用户没有对该包的有效订单application/json
401未经授权application/json
/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=textGET /user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text HTTP/1.1
Host: user-api.proxyshard.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*curl -X GET 'https://user-api.proxyshard.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text' \
-H 'Authorization: Bearer YOUR_SECRET_TOKEN'import requests
# API token — see Authorizations above.
token = "YOUR_SECRET_TOKEN"
url = "https://user-api.proxyshard.com/user/api/proxies/isps"
params = {
"proxy_type": "premium",
"country_code": "text",
"region_code": "text",
"city_code": "text",
}
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.proxyshard.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text";
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.proxyshard.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text"
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.proxyshard.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text")
.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.proxyshard.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text");
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.proxyshard.com/user/api/proxies/isps?proxy_type=premium&country_code=text®ion_code=text&city_code=text");
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;
}{
"count": 1,
"results": [
{
"code": "text",
"name": "text",
"country": {
"code": "text",
"name": "text"
},
"region": {
"code": "text",
"name": "text"
}
}
]
}{
"success": false,
"message": "ISP targeting is available for the premium package only"
}{
"success": true,
"message": "text"
}最后更新