| 1 |
# `update` - [Sessions API](../README.md#sessions-api) |
| 2 |
|
| 3 |
The `update` method of the sessions API makes it possible to modify a sessions configuration while its status is `PENDING`. This can be used to configure the session on a second device, rather than on the device under test. |
| 4 |
|
| 5 |
## HTTP Request |
| 6 |
|
| 7 |
`PUT /api/sessions/<session_token>` |
| 8 |
|
| 9 |
## Request Payload |
| 10 |
|
| 11 |
The request payload is the same as in the [`create`](./sessions-api/create.md) method of the sessions API. Only keys that are an inherent part of the configuration will stay the same if not specified in the `update` payload. All others will be deleted if not included. |
| 12 |
|
| 13 |
## Example |
| 14 |
|
| 15 |
**Request:** |
| 16 |
|
| 17 |
`GET /api/sessions/47a6fa50-c331-11e9-8709-a8eaa0ecfd0e` |
| 18 |
|
| 19 |
**Response:** |
| 20 |
|
| 21 |
```json |
| 22 |
{ |
| 23 |
"token": "47a6fa50-c331-11e9-8709-a8eaa0ecfd0e", |
| 24 |
"tests": { |
| 25 |
"include": ["/apiOne", "/apiTwo/sub"], |
| 26 |
"exclude": ["/apiOne/specials"] |
| 27 |
}, |
| 28 |
"types": ["automatic"], |
| 29 |
"timeouts": { |
| 30 |
"automatic": 70000, |
| 31 |
"/apiOne/example/dir": 30000, |
| 32 |
"/apiOne/example/filehtml": 45000 |
| 33 |
}, |
| 34 |
"reference_tokens": [ |
| 35 |
"ce2dc080-c283-11e9-b4d6-e046513784c2", |
| 36 |
"430f47d0-c283-11e9-8776-fcbc36b81035" |
| 37 |
], |
| 38 |
"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", |
| 39 |
"browser": { |
| 40 |
"name": "Chromium", |
| 41 |
"version": "76" |
| 42 |
}, |
| 43 |
"is_public": "false", |
| 44 |
"labels": [] |
| 45 |
} |
| 46 |
``` |
| 47 |
|
| 48 |
**Request:** |
| 49 |
|
| 50 |
`PUT /api/sessions/47a6fa50-c331-11e9-8709-a8eaa0ecfd0e` |
| 51 |
|
| 52 |
```json |
| 53 |
{ |
| 54 |
"tests": { |
| 55 |
"include": ["/apiOne", "/apiThree"] |
| 56 |
}, |
| 57 |
"timeouts": { |
| 58 |
"automatic": 60000 |
| 59 |
}, |
| 60 |
"reference_tokens": [ |
| 61 |
"bb7aafa0-6a92-11e9-8ec2-04f58dad2e4f", |
| 62 |
"a50c6db0-6a94-11e9-8d1b-e23fc4555885" |
| 63 |
], |
| 64 |
"labels": ["label1", "label2"] |
| 65 |
} |
| 66 |
``` |
| 67 |
|
| 68 |
**Response:** |
| 69 |
|
| 70 |
`200 OK` |
| 71 |
|
| 72 |
**Request:** |
| 73 |
|
| 74 |
`GET /api/sessions/47a6fa50-c331-11e9-8709-a8eaa0ecfd0e` |
| 75 |
|
| 76 |
**Response:** |
| 77 |
|
| 78 |
```json |
| 79 |
{ |
| 80 |
"token": "47a6fa50-c331-11e9-8709-a8eaa0ecfd0e", |
| 81 |
"tests": { |
| 82 |
"include": ["/apiOne", "/apiThree"], |
| 83 |
"exclude": ["/apiOne/specials"] |
| 84 |
}, |
| 85 |
"types": ["automatic"], |
| 86 |
"timeouts": { |
| 87 |
"automatic": 60000, |
| 88 |
"manual": 360000 |
| 89 |
}, |
| 90 |
"reference_tokens": [ |
| 91 |
"bb7aafa0-6a92-11e9-8ec2-04f58dad2e4f", |
| 92 |
"a50c6db0-6a94-11e9-8d1b-e23fc4555885" |
| 93 |
], |
| 94 |
"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", |
| 95 |
"browser": { |
| 96 |
"name": "Chromium", |
| 97 |
"version": "76" |
| 98 |
}, |
| 99 |
"is_public": "false", |
| 100 |
"labels": ["label1", "label2"] |
| 101 |
} |
| 102 |
``` |