Delete Session ID
Deletes a session ID.
Session ID that needs to be deleted is passed in cookies.
Example
Request
-
Bash
-
JavaScript
-
NodeJS
-
Python
session_id=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/users/session
curl -X DELETE $url -H "Cookie: sid=$session_id"
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));
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();
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)