| 1 |
# `read sessions` - [Sessions API](../README.md#sessions-api) |
| 2 |
|
| 3 |
The `read sessions` method of the sessions API fetches a list of all available |
| 4 |
session's token with the option expand the returned data by all retrieved |
| 5 |
tokens corresponding session configurations or statuses. |
| 6 |
|
| 7 |
## HTTP Request |
| 8 |
|
| 9 |
``` |
| 10 |
GET /api/sessions |
| 11 |
``` |
| 12 |
|
| 13 |
### Query Parameters |
| 14 |
|
| 15 |
| Parameter | Description | Default | |
| 16 |
| --------- | ---------------------------------------------------------------------------------------------------- | ------- | |
| 17 |
| `index` | At what index of all session to start the returned list. | `0` | |
| 18 |
| `count` | How many entries to return starting from `index`. | `10` | |
| 19 |
| `expand` | Comma separated list of relations from `_links`. Includes additional data in the `_embedded` object. | none | |
| 20 |
|
| 21 |
### Response Payload |
| 22 |
|
| 23 |
``` |
| 24 |
200 OK |
| 25 |
Content-Type: application/json+hal |
| 26 |
``` |
| 27 |
|
| 28 |
```json |
| 29 |
{ |
| 30 |
"_links": { |
| 31 |
"<relation>": { |
| 32 |
"href": "String" |
| 33 |
} |
| 34 |
... |
| 35 |
}, |
| 36 |
"_embedded": { |
| 37 |
"<relation>": "Array<Any>" |
| 38 |
... |
| 39 |
}, |
| 40 |
"items": "Array<String>" |
| 41 |
} |
| 42 |
``` |
| 43 |
|
| 44 |
- **\_links** contains URLs to related data. For more, see [HAL Specfication](https://tools.ietf.org/html/draft-kelly-json-hal). |
| 45 |
- **\_embedded** additional content specified by `expand` query paramater. For more, see [HAL Specfication](https://tools.ietf.org/html/draft-kelly-json-hal). |
| 46 |
- **items** contains the returned list of session tokens. |
| 47 |
|
| 48 |
## Example |
| 49 |
|
| 50 |
``` |
| 51 |
GET /api/sessions?index=0&count=3&expand=status |
| 52 |
``` |
| 53 |
|
| 54 |
``` |
| 55 |
200 OK |
| 56 |
Content-Type: application/json+hal |
| 57 |
``` |
| 58 |
|
| 59 |
```json |
| 60 |
{ |
| 61 |
"_links": { |
| 62 |
"first": { |
| 63 |
"href": "/_wave/api/sessions?index=0&count=3" |
| 64 |
}, |
| 65 |
"last": { |
| 66 |
"href": "/_wave/api/sessions?index=39&count=3" |
| 67 |
}, |
| 68 |
"self": { |
| 69 |
"href": "/_wave/api/sessions?index=0&count=3" |
| 70 |
}, |
| 71 |
"next": { |
| 72 |
"href": "/_wave/api/sessions?index=3&count=3" |
| 73 |
}, |
| 74 |
"configuration": { |
| 75 |
"href": "/_wave/api/sessions/{token}", |
| 76 |
"templated": true |
| 77 |
}, |
| 78 |
"status": { |
| 79 |
"href": "/_wave/api/sessions/{token}/status", |
| 80 |
"templated": true |
| 81 |
} |
| 82 |
}, |
| 83 |
"items": [ |
| 84 |
"13f80c84-9046-11ea-9c80-0021ccd76152", |
| 85 |
"34db08e4-903b-11ea-89ce-0021ccd76152", |
| 86 |
"a355f846-9465-11ea-ae9e-0021ccd76152" |
| 87 |
], |
| 88 |
"_embedded": { |
| 89 |
"status": [ |
| 90 |
{ |
| 91 |
"status": "completed", |
| 92 |
"expiration_date": null, |
| 93 |
"labels": [], |
| 94 |
"date_finished": 1588844145897.157, |
| 95 |
"token": "13f80c84-9046-11ea-9c80-0021ccd76152", |
| 96 |
"date_created": null, |
| 97 |
"date_started": 1588844127000, |
| 98 |
"type": "wmas" |
| 99 |
}, |
| 100 |
{ |
| 101 |
"status": "completed", |
| 102 |
"expiration_date": null, |
| 103 |
"labels": [], |
| 104 |
"date_finished": 1588839822768.9568, |
| 105 |
"token": "34db08e4-903b-11ea-89ce-0021ccd76152", |
| 106 |
"date_created": null, |
| 107 |
"date_started": 1588839522000, |
| 108 |
"type": "wmas" |
| 109 |
}, |
| 110 |
{ |
| 111 |
"status": "completed", |
| 112 |
"expiration_date": null, |
| 113 |
"labels": [], |
| 114 |
"date_finished": 1589297485065.1802, |
| 115 |
"token": "a355f846-9465-11ea-ae9e-0021ccd76152", |
| 116 |
"date_created": null, |
| 117 |
"date_started": 1589297484000, |
| 118 |
"type": "wmas" |
| 119 |
} |
| 120 |
] |
| 121 |
} |
| 122 |
} |
| 123 |
``` |