白名单
下面提供的链接指向一个详细的页面,详细说明了我们系统中的“白名单”的概念。
值得注意的是,几乎所有端点都与白名单相关,除了index
和 delete
等值得注意的例外情况外,将在成功调用时返回白名单条目资源。
WhitelistEntryResource
{
"hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
"ip": "192.0.2.1",
"port": "23234",
"type": "http|https",
"configuration": "_country-br_streaming-1_skipispstatic-1"
}
创建白名单条目
POST
/residential-users/{ residential_user_hash }/whitelist-entries
查询参数
正文参数
請求範例
curl -X POST "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries" \
-H "Authorization: Bearer <your_api_token>" \
-H "Content-Type: application/json" \
-d '{
"ip": "192.168.1.1",
"port": 8080,
"configuration": "some_configuration"
}'
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$ip = '192.168.1.1';
$port = 8080;
$configuration = 'some_configuration';
$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/whitelist-entries";
$data = [
'ip' => $ip,
'port' => $port,
'configuration' => $configuration
];
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $api_token",
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode($data)
];
$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_api_token>'
residential_user_hash = '<residential_user_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries'
data = {
'ip': '192.168.1.1',
'port': 8080,
'configuration': 'some_configuration'
}
headers = {
'Authorization': f'Bearer {api_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, json=data, headers=headers)
print(response.status_code)
print(response.text)
const https = require('https');
const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const ip = '192.168.1.1';
const port = 8080;
const configuration = 'some_configuration';
const data = JSON.stringify({ ip, port, configuration });
const options = {
hostname: 'resi-api.iproyal.com',
path: `/v1/residential-users/${residential_user_hash}/whitelist-entries`,
method: 'POST',
headers: {
'Authorization': `Bearer ${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();
获取白名单条目
GET
/residential-users/{ residential_user_hash }/whitelist-entries/{ whitelist_entry_hash }
查询参数
請求範例
curl -X GET "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries/<whitelist_entry_hash>" \
-H "Authorization: Bearer <your_api_token>"
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$whitelist_entry_hash = '<whitelist_entry_hash>';
$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/whitelist-entries/$whitelist_entry_hash";
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $api_token"
]
];
$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_api_token>'
residential_user_hash = '<residential_user_hash>'
whitelist_entry_hash = '<whitelist_entry_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries/{whitelist_entry_hash}'
headers = {
'Authorization': f'Bearer {api_token}'
}
response = requests.get(url, headers=headers)
print(response.text)
const https = require('https');
const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const whitelist_entry_hash = '<whitelist_entry_hash>';
const options = {
hostname: 'resi-api.iproyal.com',
path: `/v1/residential-users/${residential_user_hash}/whitelist-entries/${whitelist_entry_hash}`,
method: 'GET',
headers: {
'Authorization': `Bearer ${api_token}`
}
};
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();
获取多个白名单条目
GET
/residential-users/{ residential_user_hash }/whitelist-entries/
查询参数
請求範例
curl -X GET "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries?page=<page>&per_page=<per_page>" \
-H "Authorization: Bearer <your_api_token>"
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$page = 1;
$per_page = 10;
$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/whitelist-entries?page=$page&per_page=$per_page";
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $api_token"
]
];
$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_api_token>'
residential_user_hash = '<residential_user_hash>'
page = 1
per_page = 10
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries?page={page}&per_page={per_page}'
headers = {
'Authorization': f'Bearer {api_token}'
}
response = requests.get(url, headers=headers)
print(response.text)
const https = require('https');
const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const page = 1;
const per_page = 10;
const options = {
hostname: 'resi-api.iproyal.com',
path: `/v1/residential-users/${residential_user_hash}/whitelist-entries?page=${page}&per_page=${per_page}`,
method: 'GET',
headers: {
'Authorization': `Bearer ${api_token}`
}
};
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();curl -X GET "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries?page=<page>&per_page=<per_page>" \
-H "Authorization: Bearer <your_api_token>"
更新白名单条目
UPDATE
/residential-users/{ residential_user_hash }/whitelist-entries/{ whitelist_entry_hash }
查询参数
正文参数
請求範例
curl -X PUT "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries/<whitelist_entry_hash>" \
-H "Authorization: Bearer <your_api_token>" \
-H "Content-Type: application/json" \
-d '{
"configuration": {}
}'
import requests
api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
whitelist_entry_hash = '<whitelist_entry_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries/{whitelist_entry_hash}'
configuration = {
'configuration': {}
}
headers = {
'Authorization': f'Bearer {api_token}',
'Content-Type': 'application/json'
}
response = requests.put(url, json=configuration, headers=headers)
print(response.text)
import requests
api_token = '<your_api_token>'
residential_user_hash = '<residential_user_hash>'
whitelist_entry_hash = '<whitelist_entry_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries/{whitelist_entry_hash}'
configuration = {
'configuration': {}
}
headers = {
'Authorization': f'Bearer {api_token}',
'Content-Type': 'application/json'
}
response = requests.put(url, json=configuration, headers=headers)
print(response.text)
const https = require('https');
const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const whitelist_entry_hash = '<whitelist_entry_hash>';
const configuration = JSON.stringify({
configuration: {}
});
const options = {
hostname: 'resi-api.iproyal.com',
path: `/v1/residential-users/${residential_user_hash}/whitelist-entries/${whitelist_entry_hash}`,
method: 'PUT',
headers: {
'Authorization': `Bearer ${api_token}`,
'Content-Type': 'application/json',
'Content-Length': configuration.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(configuration);
req.end();
删除白名单条目
DELETE
/residential-users/{ residential_user_hash }/whitelist-entries/{ whitelist_entry_hash }
查询参数
請求範例
curl -X DELETE "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries/<whitelist_entry_hash>" \
-H "Authorization: Bearer <your_api_token>"
<?php
$api_token = '<your_api_token>';
$residential_user_hash = '<residential_user_hash>';
$whitelist_entry_hash = '<whitelist_entry_hash>';
$url = "https://resi-api.iproyal.com/v1/residential-users/$residential_user_hash/whitelist-entries/$whitelist_entry_hash";
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $api_token"
]
];
$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_api_token>'
residential_user_hash = '<residential_user_hash>'
whitelist_entry_hash = '<whitelist_entry_hash>'
url = f'https://resi-api.iproyal.com/v1/residential-users/{residential_user_hash}/whitelist-entries/{whitelist_entry_hash}'
headers = {
'Authorization': f'Bearer {api_token}'
}
response = requests.delete(url, headers=headers)
print(response.text)
const https = require('https');
const api_token = '<your_api_token>';
const residential_user_hash = '<residential_user_hash>';
const whitelist_entry_hash = '<whitelist_entry_hash>';
const options = {
hostname: 'resi-api.iproyal.com',
path: `/v1/residential-users/${residential_user_hash}/whitelist-entries/${whitelist_entry_hash}`,
method: 'DELETE',
headers: {
'Authorization': `Bearer ${api_token}`
}
};
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();curl -X DELETE "https://resi-api.iproyal.com/v1/residential-users/<residential_user_hash>/whitelist-entries/<whitelist_entry_hash>" \
-H "Authorization: Bearer <your_api_token>"
Last updated