代理
获取代理的可用性
GET
/access/availability/static-residential
返回包含可用代理数量的国家列表。
此功能须由管理员启用后方可使用。此功能要求最低总花费为10000美元。
响应案例:
curl -X GET "https://apid.iproyal.com/v1/reseller/access/availability/static-residential" \
-H "X-Access-Token: <your_access_token>" \
-H "Content-Type: application/json"
<?php
$api_token = '<your_access_token>';
$url = "https://apid.iproyal.com/v1/reseller/access/availability/static-residential";
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-Access-Token: $api_token",
'Content-Type: application/json'
]
];
$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
import requests
api_token = '<your_access_token>'
url = 'https://apid.iproyal.com/v1/reseller/access/availability/static-residential'
headers = {
'X-Access-Token': api_token,
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
const https = require('https');
const api_token = '<your_access_token>';
const options = {
hostname: 'apid.iproyal.com',
path: '/v1/reseller/access/availability/static-residential',
method: 'GET',
headers: {
'X-Access-Token': api_token,
'Content-Type': 'application/json'
}
};
const req = https.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log(responseData);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.end();
响应示例:
{
"data": [
{
"country_code": "DE",
"country_name": "Germany",
"available_ips": 2887
},
{
"country_code": "GB",
"country_name": "United Kingdom",
"available_ips": 2351
},
{
"country_code": "US",
"country_name": "United States",
"available_ips": 1112
},
{
"country_code": "NL",
"country_name": "Netherlands",
"available_ips": 1293
},
{
"country_code": "IT",
"country_name": "Italy",
"available_ips": 1812
},
...
]
}
更改凭证
GET
/orders/proxies/change-credentials
正文参数
响应案例:
curl -X GET "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials?order_id=12345&username=new_username&password=new_password&random_password=false&is_reset=true" \
-H "X-Access-Token: <your_access_token>" \
-H "Content-Type: application/json" \
-d '{"proxies": ["proxy1", "proxy2"]}'
<?php
$api_token = '<your_access_token>';
$order_id = 12345;
$proxies = ['proxy1', 'proxy2'];
$username = 'new_username';
$password = 'new_password';
$random_password = false;
$is_reset = true;
$url = "https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials?order_id=$order_id&username=$username&password=$password&random_password=$random_password&is_reset=$is_reset";
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-Access-Token: $api_token",
'Content-Type: application/json'
],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['proxies' => $proxies])
];
$ch = curl_init();
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
import requests
api_token = '<your_access_token>'
order_id = 12345
proxies = ['proxy1', 'proxy2']
username = 'new_username'
password = 'new_password'
random_password = False
is_reset = True
url = f'https://apid.iproyal.com/v1/reseller/orders/proxies/change-credentials?order_id={order_id}&username={username}&password={password}&random_password={random_password}&is_reset={is_reset}'
headers = {
'X-Access-Token': api_token,
'Content-Type': 'application/json'
}
response = requests.get(url, json={'proxies': proxies}, headers=headers)
print(response.status_code)
print(response.json())
const https = require('https');
const api_token = '<your_access_token>';
const order_id = 12345;
const proxies = ['proxy1', 'proxy2'];
const username = 'new_username';
const password = 'new_password';
const random_password = false;
const is_reset = true;
const data = JSON.stringify({
proxies: proxies
});
const options = {
hostname: 'apid.iproyal.com',
path: `/v1/reseller/orders/proxies/change-credentials?order_id=${order_id}&username=${username}&password=${password}&random_password=${random_password}&is_reset=${is_reset}`,
method: 'GET',
headers: {
'X-Access-Token': api_token,
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
const req = https.request(options, (res) => {
let responseData = '';
res.on('data', (chunk) => {
responseData += chunk;
});
res.on('end', () => {
console.log(responseData);
});
});
req.on('error', (error) => {
console.error('Error:', error.message);
});
req.write(data);
req.end();
Last updated