Skip to content

Latest commit

 

History

History
139 lines (116 loc) · 3.91 KB

File metadata and controls

139 lines (116 loc) · 3.91 KB

Get Session Information

Retrieve session information for any session on the workspace, regardless of the session owner. This endpoint allows authorized users to access session details across the workspace.

{% hint style="info" %}

URL Requires Auth HTTP Method
/api/v1/sessions/info.admin yes GET

Headers

ArgumentExampleRequiredDescription
X-User-Idmyuser-nameRequiredThe authenticated user ID.
X-Auth-Tokenmyauth-tokenRequiredAuth token.
x-2fa-code148750RequiredRequiredThe 2fa code.

Query Parameter

Argument Example Required Description
sessionId QoYYFw2t9oKks2niG Required The session id.

Example Call

curl --location 'http://localhost:3000/api/v1/sessions/info.admin?sessionId=uBNL9dTjJ4s6Pjp4K' \
--header 'X-Auth-Token: ocFlTSMfowj9tSH1vQV6ANL9SiahkKUK1KhU_PpAUtT' \
--header 'X-User-Id: 2tTEqR7ZNMJ4HGGNa' \
--header 'x-2fa-code: 505403'

Example Result

Success

{
    "sessionId": "uBNL9dTjJ4s6Pjp4K",
    "userId": "rYhzFRd2QZjNwAAXX",
    "device": {
        "type": "browser",
        "name": "Chrome",
        "longVersion": "113.0.0.0",
        "os": {
            "name": "Windows",
            "version": "10"
        },
        "version": "113.0.0"
    },
    "host": "localhost:3000",
    "ip": "172.20.0.2",
    "loginAt": "2023-05-24T05:08:42.806Z",
    "_user": {
        "name": "Rod",
        "username": "Rod"
    },
    "_id": "uBNL9dTjJ4s6Pjp4K",
    "success": true
}

Error

Any of the following errors can occur on the endpoint.

  • Authorization: Requires an authentication token for the request to be made.
  • No Permission: Occurs when the authenticated user doesn't have the view-device-management permission.
  • TOTP Required: Requires two-factor authentication for the request to be made.
  • Invalid TOTP: Requires a valid two-factor authentication code.
  • Session not found: Occurs when the sessionId does not exist.

{% tabs %} {% tab title="Authorization" %}

{
    "status": "error",
    "message": "You must be logged in to do this."
}

{% endtab %}

{% tab title="No Permission" %}

{
    "success": false,
    "error": "User does not have the permissions required for this action [error-unauthorized]"
}

{% endtab %}

{% tab title="Session not found" %}

{
    "success": false,
    "error": "Session not found"
}

{% endtab %}

{% tab title="TOTP Required" %}

{
    "success": false,
    "error": "TOTP Required [totp-required]",
    "errorType": "totp-required",
    "details": {
        "method": "totp",
        "codeGenerated": false,
        "availableMethods": [
            "totp"
        ]
    }
}

{% endtab %}

{% tab title="Invalid TOTP" %}

{
    "success": false,
    "error": "TOTP Invalid [totp-invalid]",
    "errorType": "totp-invalid",
    "details": {
        "method": "totp",
        "codeGenerated": false
    }
}

{% endtab %} {% endtabs %}

Change Log

Version Description
5.0.0 Added