diff --git a/Documentation/REST-API/Resources-Session.md b/Documentation/REST-API/Resources-Session.md index 03f90d0d7..20a57d6c6 100644 --- a/Documentation/REST-API/Resources-Session.md +++ b/Documentation/REST-API/Resources-Session.md @@ -1,8 +1,8 @@ # Session Resource -A session consists of a client connection, any number of related backend +A session is an abstraction of a client connection, any number of related backend connections, a router module session and possibly filter module sessions. Each -session is created on a service and a service can have multiple sessions. +session is created on a service and each service can have multiple sessions. ## Resource Operations @@ -16,23 +16,43 @@ GET /sessions/:id #### Response -``` -Status: 200 OK +`Status: 200 OK` +```javascript { - "id": 1, - "state": "Session ready for routing", - "user": "jdoe", - "address": "192.168.0.200", - "service": "/services/my-service", - "connected": "Wed Aug 31 03:03:12 2016", - "idle": 260 + "links": { + "self": "http://localhost:8989/v1/sessions/1" + }, + "data": { + "id": "1", + "type": "sessions", + "relationships": { + "services": { + "links": { + "self": "http://localhost:8989/v1/services/" + }, + "data": [ + { + "id": "RW-Split-Router", + "type": "services" + } + ] + } + }, + "attributes": { + "state": "Listener Session", + "connected": "Wed May 17 10:06:35 2017" + }, + "links": { + "self": "http://localhost:8989/v1/sessions/1" + } + } } ``` #### Supported Request Parameter -- `fields` +- `pretty` ### Get all sessions @@ -44,95 +64,90 @@ GET /sessions #### Response -``` -Status: 200 OK +`Status: 200 OK` -[ - { - "id": 1, - "state": "Session ready for routing", - "user": "jdoe", - "address": "192.168.0.200", - "service": "/services/My-Service", - "connected": "Wed Aug 31 03:03:12 2016", - "idle": 260 +```javascript +{ + "links": { + "self": "http://localhost:8989/v1/sessions/" }, - { - "id": 2, - "state": "Session ready for routing", - "user": "dba", - "address": "192.168.0.201", - "service": "/services/My-Service", - "connected": "Wed Aug 31 03:10:00 2016", - "idle": 1 - } -] + "data": [ + { + "id": "1", + "type": "sessions", + "relationships": { + "services": { + "links": { + "self": "http://localhost:8989/v1/services/" + }, + "data": [ + { + "id": "RW-Split-Router", + "type": "services" + } + ] + } + }, + "attributes": { + "state": "Listener Session", + "connected": "Wed May 17 10:06:35 2017" + }, + "links": { + "self": "http://localhost:8989/v1/sessions/1" + } + }, + { + "id": "2", + "type": "sessions", + "relationships": { + "services": { + "links": { + "self": "http://localhost:8989/v1/services/" + }, + "data": [ + { + "id": "Read-Connection-Router", + "type": "services" + } + ] + } + }, + "attributes": { + "state": "Listener Session", + "connected": "Wed May 17 10:06:35 2017" + }, + "links": { + "self": "http://localhost:8989/v1/sessions/2" + } + }, + { + "id": "3", + "type": "sessions", + "relationships": { + "services": { + "links": { + "self": "http://localhost:8989/v1/services/" + }, + "data": [ + { + "id": "CLI", + "type": "services" + } + ] + } + }, + "attributes": { + "state": "Listener Session", + "connected": "Wed May 17 10:06:35 2017" + }, + "links": { + "self": "http://localhost:8989/v1/sessions/3" + } + } + ] +} ``` #### Supported Request Parameter -- `fields` -- `range` - -### Get all connections created by a session - -Get all backend connections created by a session. _:id_ must be a valid session ID. - -``` -GET /sessions/:id/connections -``` - -#### Response - -``` -Status: 200 OK - -[ - { - "state": "DCB in the polling loop", - "role": "Backend Request Handler", - "server": "/servers/db-serv-01", - "service": "/services/my-service", - "statistics": { - "reads": 2197 - "writes": 1562 - "buffered_writes": 0 - "high_water_events": 0 - "low_water_events": 0 - } - }, - { - "state": "DCB in the polling loop", - "role": "Backend Request Handler", - "server": "/servers/db-serv-02", - "service": "/services/my-service", - "statistics": { - "reads": 0 - "writes": 0 - "buffered_writes": 0 - "high_water_events": 0 - "low_water_events": 0 - } - } -] -``` - -#### Supported Request Parameter - -- `fields` -- `range` - -### Close a session - -Close a session. This will forcefully close the client connection and any -backend connections. - -``` -DELETE /sessions/:id -``` - -#### Response - -``` -Status: 204 No Content -``` +- `pretty`