Проверить ID сессии
Проверяет действительна ли Сессия с переданным ID.
Ответ
Тело ответа содержит true
, если Сессия с заданным ID действительна, false
если недействительна.
Пример
Запрос
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
session_id=<...>
saymon_hostname=<...>
url=http://$saymon_hostname/node/api/users/session/verify/$session_id
curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let sessionID = <...>
let path = "/node/api/users/session/verify/"
let auth = "Basic " + btoa(login + ":" + password)
let myHeaders = new Headers();
myHeaders.append("Authorization", auth);
let requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch(saymonHostname + path + sessionID, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
let http = require('follow-redirects').http;
let fs = require('fs');
let saymonHostname = <...>;
let login = <...>;
let password = <...>;
let sessionID = <...>;
let auth = 'Basic ' + Buffer.from(login + ':' + password).toString('base64');
let options = {
'method': 'GET',
'hostname': saymonHostname,
'path': '/node/api/users/session/verify/' + sessionID,
'headers': {
'Authorization': auth
},
'maxRedirects': 20
};
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();
import requests
login = <...>
password = <...>
saymon_hostname = <...>
session_id = <...>
url = "http://" + saymon_hostname + "/node/api/users/session/verify/" + session_id
response = requests.request("GET", url, auth=(login, password))
print(response.text)