Create a session from a RESTful API client

POST method to create a session from a RESTful API client.

Method URL Description
POST https://host_name:port/platform/rest/symrest/v1/clientapi/session Creates a connection from a RESTful API client to an application and interacts with a session created on this connection.

Request

POST https://host_name:port/platform/rest/symrest/v1/clientapi/session?parameters
Table 1. Request parameters
Parameter Type Required/Optional Description
clusterId string Optional ID of the cluster. When your installation includes multiple clusters, if you do not specify a cluster but defined multiple clusters in the clusters parameter in symrest.json, any cluster is used for the specified application.
applicationName string Required Name of the application.
csrftoken string Optional CSRF token that is obtained with successful login.

This command takes a JSON request string or file that must contain information similar to the following example:

POST https://mysymresthost.example.com:8050/platform/rest/symrest/v1/clientapi/session?applicationName=symping7.3.2&csrftoken=915ee7644f431e630dac68b9ab3e40bc
        {
            "sessionName": "My Session",
            "sessionType": "type",
            "sessionTag": "tag",
            "sessionPriority": 10,            
            "serviceName": "My Service",            
            "commonData": [
                ["SOAM_STRING_CHARS", "Test"],
                ["SOAM_UINT32", "4"],
                ["SOAM_INT64", "1"],
                ["SOAM_UINT64", "8192"],
                ["SOAM_BYTES", "Base64 encoded string"]
            ],            
            "enableDataCompression": true,
            "parent": {
                "sessionID" : "sessionID",
                "taskID" : "taskID"            
            },
            "dataCompressionThreshold": 32,
            "dataCompressionFlags": "BestSpeed",
            "preemptive": false,  
            "serviceToSlotRatio": {
                "numServices" : 1,
                "numSlots" : 2,               
            }
            "resourceGroupFilter": "filter",            
            "preemptionRank": 10,            
            "defaultResourceAttributeValue": 100.123,      
            "resourcePreference": {
                "expression": "my expression",
                "resourceAttributeDefinition": [
                    {"name" : "my name",
                    "alias" : "my alias",
                    "defaultValue" : 20.0}
                ]
            },           
            "resourceAttributeDefinition": [
                {"name" : "my name",
                "alias" : "my alias",
                "defaultValue" : 20.0}
            ],
            "dockerMountDefinition": [
                {"hostDir" : "/tmp",
                "containerDir" : "/tmp",
                "readonly" : false},
                {"hostDir" : "/root",
                "containerDir" : "/root",
                "readonly" : true}
            ],             
            "sessionMetaData": "meta-data", 
            "attributes": {
                "sessionRetryLimit": "1",
                "taskRetryLimit": "2",
                "taskCleanupPeriod": "30"
            },
            "policyTagPath": "tag-path", 
            "taskDispatchOrder": "TaskDispatchOrderDefault", 
            "enableCloseSessionOnPhysicalSessionLost": true,            
            "datasetDependencies": ["dependency1","dependency2"],             
            "sessionTimeout": 10,                 
            "taskTimeout": 10,  
            "minServices": 10,  
            "maxServices": 10,              
            "resourceLimit": {
                "cpuLimit": 50,
                "physicalMemoryLimit": 1240,
                "virtualMemoryLimit": 6503,
                "JvmMinHeap": 500,
                "JvmMaxHeap": 300                
            },            
            "slotDefinitionName": "definition name",             
            "resourceReservationTimeout": 10, 
            "enableAbortSessionIfTaskRequeue": false,
            "sessionTTLInMinutes": 60
        }

For more information on client session creation options, see Workload API reference.

Response

This command returns a JSON string that includes a session ID; for example:
{
            "sessionId": 1200,
            "applicationName": "symping7.3.2",
            "clusterId": ""
}
Table 2. Response codes
Status code Description
200 Success
400 Bad request
401 Unauthorized
403 Forbidden