Web Sessions 4.3.9 | Web Sessions User Guide | Using Web Sessions | Managing Web Sessions Using the REST API
 
Managing Web Sessions Using the REST API
The REST API is enabled automatically and no setup is required. For general information about the REST API, refer to the Terracotta REST Developer Guide. For Web Sessions, requests can be made using /agents/sessions with /contexts and /details options.
Send requests to the management port of any server in the Terracotta Server Array, for example:
http://<server-id>:9540/tc-management-api/v2/agents/sessions/contexts
The above request will return the available contexts on all nodes, including the agentIds and the context paths.
To request details about a particular context on all nodes, add the context path, for example:
/agents/sessions/contexts/Cart
The above request will return details about the context "/Cart" on all nodes, including agentIds, number of sessions, hit ratios, and sessions counts.
Note that context paths can include more than one directory, for example "/aaa/bbb."
When working with /details you will need the agentIds. AgentIds are returned with /context requests. Note that the agentId is not unique to a node. Each context generates its own agentId.
Once you have the agentIds, you can view session details or invalidate a session.
To view session details, such as creation time, last access time, and max inactive interval:
GET: /agents;ids=xxx/sessions/details/Cart?sessionId=1234
To invalidate a session:
DELETE: /agents;ids=xxx/sessions/details/Cart?sessionId=1234