| 1 |
# `read session` - [Sessions API](../README.md#sessions-api) |
| 2 |
|
| 3 |
The `read` method of the sessions API fetches the configuration of a session, including values that can not be set by the user, but are created by the server upon creation. |
| 4 |
|
| 5 |
## HTTP Request |
| 6 |
|
| 7 |
`GET /api/sessions/<session_token>` |
| 8 |
|
| 9 |
## Response Payload |
| 10 |
|
| 11 |
```json |
| 12 |
{ |
| 13 |
"token": "String", |
| 14 |
"tests": { |
| 15 |
"include": "Array<String>", |
| 16 |
"exclude": "Array<String>" |
| 17 |
}, |
| 18 |
"types": "Enum['automatic', 'manual']", |
| 19 |
"timeouts": { |
| 20 |
"automatic": "Integer", |
| 21 |
"manual": "Integer", |
| 22 |
"<test_path>": "Integer" |
| 23 |
}, |
| 24 |
"reference_tokens": "Array<String>", |
| 25 |
"user_agent": "String", |
| 26 |
"browser": { |
| 27 |
"name": "String", |
| 28 |
"version": "String" |
| 29 |
}, |
| 30 |
"is_public": "Boolean", |
| 31 |
"date_created": "String", |
| 32 |
"labels": "Array<String>" |
| 33 |
} |
| 34 |
``` |
| 35 |
|
| 36 |
- **token** is the unique identifier of the session. |
| 37 |
- **tests** specifies the tests of the session: |
| 38 |
- **include** specifies what tests should be selected from all available tests. Can be a path to a test file or directory. |
| 39 |
- **exclude** specifies what tests should be removed from the included tests. Can be a path to a test file or directory. |
| 40 |
- **types** what types of tests should be included. Possible values: |
| 41 |
- **automatic** tests are tests that execute without user interaction. |
| 42 |
- **manual** tests are tests that require user interaction. |
| 43 |
- **timeouts** specifies the time to wait for a test to finish in milliseconds. |
| 44 |
- **automatic**: Sets the default timeout for all automatic tests. |
| 45 |
- **manual**: Sets the default timeout for all manual tests. |
| 46 |
- **custom test paths**: Set the timeout for a test file or directory by putting the path with all dots removed as the key. |
| 47 |
- **reference_tokens** specifies a set of completed sessions that is used to filter out all tests that have not passed in all those sessions from the session that is going to be created. |
| 48 |
- **user_agent** is the user agent string of the request that created the session. The request to create the session should performed by the device under test. |
| 49 |
- **browser** holds information about the browser, parsed from the user agent. |
| 50 |
- **name**: The name of the browser. |
| 51 |
- **version**: The version numbers of the browser. |
| 52 |
- **is_public** defines whether or not the session is listed when fetching the list of public session using [`read public`](./read-public.md). |
| 53 |
- **date_created**: The date the session was created in ISO 8601 format. |
| 54 |
- **labels**: A list of the sessions labels. |
| 55 |
|
| 56 |
## Example |
| 57 |
|
| 58 |
**Request:** |
| 59 |
|
| 60 |
`GET /api/sessions/47a6fa50-c331-11e9-8709-a8eaa0ecfd0e` |
| 61 |
|
| 62 |
**Response:** |
| 63 |
|
| 64 |
```json |
| 65 |
{ |
| 66 |
"token": "47a6fa50-c331-11e9-8709-a8eaa0ecfd0e", |
| 67 |
"tests": { |
| 68 |
"include": ["/apiOne", "/apiTwo/sub"], |
| 69 |
"exclude": ["/apiOne/specials"] |
| 70 |
}, |
| 71 |
"types": ["automatic"], |
| 72 |
"timeouts": { |
| 73 |
"automatic": 70000, |
| 74 |
"/apiOne/example/dir": 30000, |
| 75 |
"/apiOne/example/filehtml": 45000 |
| 76 |
}, |
| 77 |
"reference_tokens": [ |
| 78 |
"ce2dc080-c283-11e9-b4d6-e046513784c2", |
| 79 |
"430f47d0-c283-11e9-8776-fcbc36b81035" |
| 80 |
], |
| 81 |
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/76.0.3809.100 Chrome/76.0.3809.100 Safari/537.36", |
| 82 |
"browser": { |
| 83 |
"name": "Chromium", |
| 84 |
"version": "76" |
| 85 |
}, |
| 86 |
"is_public": "false", |
| 87 |
"date_created": "2020-05-25T11:37:07", |
| 88 |
"labels": ["labelA", "labelB"] |
| 89 |
} |
| 90 |
``` |