Toggle menu

createSession

Description

Creates a session and its associated data, generating a sessionKey.

Parameters

NameTypeDescription
dataObject, optionalA JSON object containing the data you'd like to store in the session. Default {}
platformString, requiredEither "CF", "ICM", "JAVA", "DOTNET" or "APISERVER"
platformVersionString, optionalAn optional version number 

Example Request

function(params, credentials) {
    let result = this.callWorkerMethod('sitesessionstore', 'createSession', {
        "platform": "APISERVER",
        "platformVersion": "1",
        "data": {
            "message": "hello",
            "moreData": {
                "example": "tadah"
            }
        }
    });
    return result;
}

Response

NameTypeDescription
createdString, ISO datetimeThe create time of the session
platformStringThe platform set in the request
platformVersionStringThe platform version set in the request
sessionKeyStringThe session key with the update count appended 
updateCountIntegerNew sessions have a count of 0
updatedString, ISO datetimeWhen the session was last updated. Matches the created time on create

Example Response

{
    "id": 81,
    "result": {
        "updateCount": 0,
        "sessionKey": "5cb4d890-2ea6-4deb-a09d-5ad8f78a2964_0",
        "created": "2023-08-01T13:05:54Z",
        "platformVersion": "1",
        "updated": "2023-08-01T13:05:54Z",
        "platform": "APISERVER"
    },
    "jsonrpc": "2.0"
}

Platform and Version

The platform property, and corresponding database table, indicates the platform that created the session. The values correspond to the three supported website platform technologies, iCM and the API Server itself.

The platformVersion property is designed to hold a platform specific version number.

Both properties are provided to segregate different session types and to make it easier for you to detect or invalidate sessions that may not be compatible with an updated release of your code.

Last modified on August 01, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon