删除会话
Remove Sessions
DELETE
/sessions
正文参数
請求範例:
curl -X DELETE https://resi-api.iproyal.com/v1/sessions \
-H "Authorization: Bearer <your_api_token>" \
-H "Content-Type: application/json" \
-d '{"residential_user_hashes":["hash1","hash2","hash3"]}'
<?php
$api_token = '<your_api_token>';
$url = 'https://resi-api.iproyal.com/v1/sessions';
$residential_user_hashes = ['hash1', 'hash2', 'hash3'];
$data = json_encode(['residential_user_hashes' => $residential_user_hashes]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$headers = [
"Authorization: Bearer $api_token",
"Content-Type: application/json"
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$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>'
url = 'https://resi-api.iproyal.com/v1/sessions'
residential_user_hashes = ['hash1', 'hash2', 'hash3']
data = {'residential_user_hashes': residential_user_hashes}
headers = {
'Authorization': f'Bearer {api_token}',
'Content-Type': 'application/json'
}
response = requests.delete(url, headers=headers, json=data)
print(response.text)
const https = require('https');
const apiToken = '<your_api_token>';
const url = 'https://resi-api.iproyal.com/v1/sessions';
const residentialUserHashes = ['hash1', 'hash2', 'hash3'];
const data = JSON.stringify({ residential_user_hashes: residentialUserHashes });
const options = {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
const req = https.request(url, 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