MaxScale/Documentation/REST-API/Resources-Session.md
Markus Makela 59e615eb3c Create initial REST API documentation
The Resources document lists all currently known resources and will be converted
to a list of separate resource documents once the individual resource documents
are done. The Headers and Response Codes document contains a list of request and
response headers and the HTTP return codes. This is a work in progress and will
be expanded upon.

Added initial versions of the filter, monitor, session and user resource
documents. These provide information about various parts of MaxScale and
allow interaction.

All PATCH operations expect a JSON Patch type document in the request
body. Examples modified accordingly.

Add MaxScale resource document which describes the resources that give the
global configuration options and show statistics.

The resources that link to other resources provide values as a list of
relative links. This reduces the amount of sent data when the client
doesn't require all parts of the resource.

Since the updating is not yet implement, it should be stated that the update API
will most likely be modified at some point.

The module resource is similar to `maxadmin show modules` and the log
resource contains status information about logs. The log resource also has
an "action" resource at `/maxscale/logs/flush` which flushes logs to disk
and rotates them.

Added start and stop entry points for services and monitors. Also added
missing service parameters to the list of parameters that can be updated.

The documentation lists listeners as a sub-resource of the
service. This allows the listeners of a particular service to be queried.
2016-11-07 14:20:44 +02:00

2.5 KiB

Session Resource

A session consists 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.

Resource Operations

Get a session

Get a single session. :id must be a valid session ID.

GET /sessions/:id

Response

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
}

Supported Request Parameter

  • fields

Get all sessions

Get all sessions.

GET /sessions

Response

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
    },
    {
        "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
    }
]

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