Удалить ID сессии
Удаляет Сессию.
ID сессии, которую нужно удалить, берётся из куки.
Запрос
HTTP Запрос
text
DELETE /node/api/users/sessionПараметры пути
Параметры не требуются.
Тело запроса
Тело запроса пустое.
Ответ
Тело ответа пустое.
Пример
Запрос
- Bash
- JavaScript
- NodeJS
- Python
bash
session_id=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/users/session
curl -X DELETE $url -H "Cookie: sid=$session_id"javascript
let sessionId = <...>
let saymonHostname = <...>
let path = "/node/api/users/session";
let headers = new Headers();
headers.append("Cookie", "sid=" + sessionId);
let requestOptions = {
method: "DELETE",
headers: headers
};
fetch(saymonHostname + path, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log("error", error));javascript
const http = require("http");
let sessionId = <...>
let saymonHostname = <...>
let path = "/node/api/users/session";
let options = {
"method": "DELETE",
"hostname": saymonHostname,
"headers": {
"Cookie": "sid=" + sessionId
},
"path": path
};
let req = http.request(options, function (res) {
let chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
let body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();python
import requests
session_id = <...>
saymon_hostname = <...>
url = "https://" + saymon_hostname + "/node/api/users/session"
headers={"Cookie": "sid=" + session_id}
response = requests.request("DELETE", url, headers=headers)
print(response.text)