Verify Session ID

Verifies whether the provided session ID is valid.

Request

HTTP Request

GET /node/api/users/session/verify/:sid

Path parameters

Parameter Type Description

sid

String
required

The session ID to be verified. It’s also possible to provide session ID in Cookies: sid=$sid or X-Session-Id: $sid headers instead.

Request body

The request body is empty.

Response

The response body contains true if the session ID is valid and false if not.

Example

Request

  • 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)

Response

true