Files
MaxScale/Documentation/REST-API/Resources-Session.md
Markus Mäkelä c98f8369f2 MXS-1220: Remove redundant parameter documentation
As all requests support the only parameter `pretty`, there's no point in
documenting it separately for each resource.
2017-05-24 16:21:34 +03:00

3.5 KiB

Session Resource

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 each service can have multiple sessions.

Resource Operations

Get a session

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

GET /v1/sessions/:id

Response

Status: 200 OK

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

Get all sessions

Get all sessions.

GET /v1/sessions

Response

Status: 200 OK

{
    "links": {
        "self": "http://localhost:8989/v1/sessions/"
    },
    "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"
            }
        }
    ]
}