|
| 1 | +[[timeline-template-api-update]] |
| 2 | +=== Update Timeline or Timeline template |
| 3 | + |
| 4 | +Updates an existing Timeline or Timeline template. |
| 5 | + |
| 6 | +Use the `timeline` object's <<timeline-object-typeField, `timelineType`>> field |
| 7 | +to specify whether you're updating a Timeline or a Timeline template: |
| 8 | + |
| 9 | +* `"timelineType": "default"` updates an existing Timeline. |
| 10 | +* `"timelineType": "template"` updates an existing Timeline template. |
| 11 | + |
| 12 | +==== Request URL |
| 13 | + |
| 14 | +`PATCH <kibana host>:<port>/api/timeline` |
| 15 | + |
| 16 | +==== Request body |
| 17 | + |
| 18 | +A JSON object defining the Timeline or Timeline template query and time filter. |
| 19 | + |
| 20 | +NOTE: For detailed information about the Timeline object schema and its |
| 21 | +corresponding UI components, refer to <<timeline-object-schema>>. |
| 22 | + |
| 23 | +[width="100%",options="header"] |
| 24 | +|============================================== |
| 25 | +|Name |Type |Description |Required |
| 26 | + |
| 27 | +|`timeline` |<<timeline-object-schema, timeline>> a|The `timeline` object of the Timeline or Timeline template that you're updating. |
| 28 | + |
| 29 | +If you're updating a Timeline template, provide these fields so you can |
| 30 | +easily <<timeline-api-import, import template>> updates: |
| 31 | + |
| 32 | +* `templateTimelineId`: Use the unique identifier (UUID) of the Timeline template that you're updating. |
| 33 | +* `templateTimelineVersion`: Specify a new version number for the template. It must be greater than the existing version number. |
| 34 | + |
| 35 | +|Yes |
| 36 | +|`timelineId` |String |The `savedObjectId` of the Timeline or Timeline template that you're updating. |
| 37 | +|Yes |
| 38 | +|`version` |String |The version of the Timeline or Timeline template that you're updating. |
| 39 | +|Yes |
| 40 | +|============================================== |
| 41 | + |
| 42 | +===== Example requests |
| 43 | + |
| 44 | +*Example 1* |
| 45 | + |
| 46 | +Updates an existing Timeline. |
| 47 | + |
| 48 | +[source,console] |
| 49 | +-------------------------------------------------- |
| 50 | +PATCH api/timeline |
| 51 | +{ |
| 52 | + "timeline": { |
| 53 | + "columns": [ |
| 54 | + { |
| 55 | + "columnHeaderType": "not-filtered", |
| 56 | + "id": "@timestamp" |
| 57 | + }, |
| 58 | + { |
| 59 | + "columnHeaderType": "not-filtered", |
| 60 | + "id": "message" |
| 61 | + }, |
| 62 | + { |
| 63 | + "columnHeaderType": "not-filtered", |
| 64 | + "id": "event.category" |
| 65 | + }, |
| 66 | + { |
| 67 | + "columnHeaderType": "not-filtered", |
| 68 | + "id": "event.action" |
| 69 | + }, |
| 70 | + { |
| 71 | + "columnHeaderType": "not-filtered", |
| 72 | + "id": "host.name" |
| 73 | + }, |
| 74 | + { |
| 75 | + "columnHeaderType": "not-filtered", |
| 76 | + "id": "source.ip" |
| 77 | + }, |
| 78 | + { |
| 79 | + "columnHeaderType": "not-filtered", |
| 80 | + "id": "destination.ip" |
| 81 | + }, |
| 82 | + { |
| 83 | + "columnHeaderType": "not-filtered", |
| 84 | + "id": "user.name" |
| 85 | + } |
| 86 | + ], |
| 87 | + "dataProviders": [], |
| 88 | + "description": "", |
| 89 | + "eventType": "all", |
| 90 | + "filters": [], |
| 91 | + "kqlMode": "filter", |
| 92 | + "kqlQuery": { |
| 93 | + "filterQuery": null |
| 94 | + }, |
| 95 | + "title": "abd", |
| 96 | + "dateRange": { |
| 97 | + "start": 1587370079200, |
| 98 | + "end": 1587456479201 |
| 99 | + }, |
| 100 | + "savedQueryId": null, |
| 101 | + "sort": { |
| 102 | + "columnId": "@timestamp", |
| 103 | + "sortDirection": "desc" |
| 104 | + }, |
| 105 | + "created": 1587468588922, |
| 106 | + "createdBy": "casetester", |
| 107 | + "updated": 1587468588922, |
| 108 | + "updatedBy": "casetester", |
| 109 | + "timelineType": "default" |
| 110 | + }, |
| 111 | + "timelineId": "4bc294e0-3516-11ee-9f62-49614d8a84fd", <1> |
| 112 | + "version": "WzE5MTUsMV0=" <2> |
| 113 | +} |
| 114 | +-------------------------------------------------- |
| 115 | + |
| 116 | +<1> `timelineId` must match the `savedObjectId` of the Timeline that you're updating. |
| 117 | +<2> `version` must match the `version` of the Timeline that you're updating. |
| 118 | + |
| 119 | +*Example 2* |
| 120 | + |
| 121 | +Updates an existing Timeline template. |
| 122 | + |
| 123 | +[source,console] |
| 124 | +-------------------------------------------------- |
| 125 | +PATCH api/timeline |
| 126 | +{ |
| 127 | + "timeline": { |
| 128 | + "columns": [ |
| 129 | + { |
| 130 | + "columnHeaderType": "not-filtered", |
| 131 | + "id": "@timestamp" |
| 132 | + }, |
| 133 | + { |
| 134 | + "columnHeaderType": "not-filtered", |
| 135 | + "id": "message" |
| 136 | + }, |
| 137 | + { |
| 138 | + "columnHeaderType": "not-filtered", |
| 139 | + "id": "event.category" |
| 140 | + }, |
| 141 | + { |
| 142 | + "columnHeaderType": "not-filtered", |
| 143 | + "id": "event.action" |
| 144 | + }, |
| 145 | + { |
| 146 | + "columnHeaderType": "not-filtered", |
| 147 | + "id": "host.name" |
| 148 | + }, |
| 149 | + { |
| 150 | + "columnHeaderType": "not-filtered", |
| 151 | + "id": "source.ip" |
| 152 | + }, |
| 153 | + { |
| 154 | + "columnHeaderType": "not-filtered", |
| 155 | + "id": "destination.ip" |
| 156 | + }, |
| 157 | + { |
| 158 | + "columnHeaderType": "not-filtered", |
| 159 | + "id": "user.name" |
| 160 | + } |
| 161 | + ], |
| 162 | + "dataProviders": [], |
| 163 | + "description": "", |
| 164 | + "eventType": "all", |
| 165 | + "filters": [], |
| 166 | + "kqlMode": "filter", |
| 167 | + "kqlQuery": { |
| 168 | + "filterQuery": null |
| 169 | + }, |
| 170 | + "title": "abd", |
| 171 | + "dateRange": { |
| 172 | + "start": 1587370079200, |
| 173 | + "end": 1587456479201 |
| 174 | + }, |
| 175 | + "savedQueryId": null, |
| 176 | + "sort": { |
| 177 | + "columnId": "@timestamp", |
| 178 | + "sortDirection": "desc" |
| 179 | + }, |
| 180 | + "timelineType": "template", |
| 181 | + "created": 1587473119992, |
| 182 | + "createdBy": "casetester", |
| 183 | + "updated": 1587473119992, |
| 184 | + "updatedBy": "casetester", |
| 185 | + "templateTimelineId": "6f9a3480-bf4f-11ea-9fcd-ed4e5fd0dcd1", <1> |
| 186 | + "templateTimelineVersion": 2 <2> |
| 187 | + }, |
| 188 | + "timelineId": "7d7d4b60-3516-11ee-9f62-49614d8a84fd", <3> |
| 189 | + "version": "WzE5MTcsMV0=" <4> |
| 190 | +} |
| 191 | +-------------------------------------------------- |
| 192 | +<1> `templateTimelineId` must match the `templateTimelineId` of the Timeline template that you're updating. |
| 193 | +<2> `templateTimelineVersion` must be a Timeline template version greater than the existing one. |
| 194 | +<3> `timelineId` must match the `savedObjectId` of the Timeline template that you're updating. |
| 195 | +<4> `version` must match the `version` of the Timeline template that you're updating. |
| 196 | + |
| 197 | +==== Response code |
| 198 | + |
| 199 | +`200`:: |
| 200 | + Indicates a successful call. |
| 201 | + |
| 202 | +==== Response payload |
| 203 | + |
| 204 | +A JSON Timeline object with a unique `savedObjectId` and its `version`. |
| 205 | + |
| 206 | +*Example 1* |
| 207 | + |
| 208 | +Response payload of an updated Timeline: |
| 209 | + |
| 210 | +[source,json] |
| 211 | +-------------------------------------------------- |
| 212 | +{ |
| 213 | + "data": { |
| 214 | + "persistTimeline": { |
| 215 | + "code": 200, |
| 216 | + "message": "success", |
| 217 | + "timeline": { |
| 218 | + "savedObjectId": "4bc294e0-3516-11ee-9f62-49614d8a84fd", |
| 219 | + "version": "WzE5MTgsMV0=", |
| 220 | + "columns": [ |
| 221 | + { |
| 222 | + "columnHeaderType": "not-filtered", |
| 223 | + "id": "@timestamp" |
| 224 | + }, |
| 225 | + { |
| 226 | + "columnHeaderType": "not-filtered", |
| 227 | + "id": "message" |
| 228 | + }, |
| 229 | + { |
| 230 | + "columnHeaderType": "not-filtered", |
| 231 | + "id": "event.category" |
| 232 | + }, |
| 233 | + { |
| 234 | + "columnHeaderType": "not-filtered", |
| 235 | + "id": "event.action" |
| 236 | + }, |
| 237 | + { |
| 238 | + "columnHeaderType": "not-filtered", |
| 239 | + "id": "host.name" |
| 240 | + }, |
| 241 | + { |
| 242 | + "columnHeaderType": "not-filtered", |
| 243 | + "id": "source.ip" |
| 244 | + }, |
| 245 | + { |
| 246 | + "columnHeaderType": "not-filtered", |
| 247 | + "id": "destination.ip" |
| 248 | + }, |
| 249 | + { |
| 250 | + "columnHeaderType": "not-filtered", |
| 251 | + "id": "user.name" |
| 252 | + } |
| 253 | + ], |
| 254 | + "dataProviders": [], |
| 255 | + "dataViewId": null, |
| 256 | + "description": "", |
| 257 | + "eventType": "all", |
| 258 | + "excludedRowRendererIds": [], |
| 259 | + "favorite": [], |
| 260 | + "filters": [], |
| 261 | + "kqlMode": "filter", |
| 262 | + "kqlQuery": { |
| 263 | + "filterQuery": null |
| 264 | + }, |
| 265 | + "title": "abd", |
| 266 | + "templateTimelineId": null, |
| 267 | + "templateTimelineVersion": null, |
| 268 | + "dateRange": { |
| 269 | + "start": 1587370079200, |
| 270 | + "end": 1587456479201 |
| 271 | + }, |
| 272 | + "savedQueryId": null, |
| 273 | + "created": 1587468588922, |
| 274 | + "createdBy": "casetester", |
| 275 | + "updated": 1691408201273, |
| 276 | + "updatedBy": "elastic", |
| 277 | + "timelineType": "default", |
| 278 | + "status": "active", |
| 279 | + "sort": [ |
| 280 | + { |
| 281 | + "sortDirection": "desc", |
| 282 | + "columnId": "@timestamp" |
| 283 | + } |
| 284 | + ], |
| 285 | + "eventIdToNoteIds": [], |
| 286 | + "noteIds": [], |
| 287 | + "notes": [], |
| 288 | + "pinnedEventIds": [], |
| 289 | + "pinnedEventsSaveObject": [] |
| 290 | + } |
| 291 | + } |
| 292 | + } |
| 293 | +} |
| 294 | +-------------------------------------------------- |
| 295 | + |
| 296 | +*Example 2* |
| 297 | + |
| 298 | +Response payload of an updated Timeline template: |
| 299 | + |
| 300 | +[source,json] |
| 301 | +-------------------------------------------------- |
| 302 | +{ |
| 303 | + "data": { |
| 304 | + "persistTimeline": { |
| 305 | + "code": 200, |
| 306 | + "message": "success", |
| 307 | + "timeline": { |
| 308 | + "savedObjectId": "7d7d4b60-3516-11ee-9f62-49614d8a84fd", |
| 309 | + "version": "WzE5MTksMV0=", |
| 310 | + "columns": [ |
| 311 | + { |
| 312 | + "columnHeaderType": "not-filtered", |
| 313 | + "id": "@timestamp" |
| 314 | + }, |
| 315 | + { |
| 316 | + "columnHeaderType": "not-filtered", |
| 317 | + "id": "message" |
| 318 | + }, |
| 319 | + { |
| 320 | + "columnHeaderType": "not-filtered", |
| 321 | + "id": "event.category" |
| 322 | + }, |
| 323 | + { |
| 324 | + "columnHeaderType": "not-filtered", |
| 325 | + "id": "event.action" |
| 326 | + }, |
| 327 | + { |
| 328 | + "columnHeaderType": "not-filtered", |
| 329 | + "id": "host.name" |
| 330 | + }, |
| 331 | + { |
| 332 | + "columnHeaderType": "not-filtered", |
| 333 | + "id": "source.ip" |
| 334 | + }, |
| 335 | + { |
| 336 | + "columnHeaderType": "not-filtered", |
| 337 | + "id": "destination.ip" |
| 338 | + }, |
| 339 | + { |
| 340 | + "columnHeaderType": "not-filtered", |
| 341 | + "id": "user.name" |
| 342 | + } |
| 343 | + ], |
| 344 | + "dataProviders": [], |
| 345 | + "dataViewId": null, |
| 346 | + "description": "", |
| 347 | + "eventType": "all", |
| 348 | + "excludedRowRendererIds": [], |
| 349 | + "favorite": [], |
| 350 | + "filters": [], |
| 351 | + "kqlMode": "filter", |
| 352 | + "kqlQuery": { |
| 353 | + "filterQuery": null |
| 354 | + }, |
| 355 | + "title": "abd", |
| 356 | + "templateTimelineId": "6f9a3480-bf4f-11ea-9fcd-ed4e5fd0dcd1", |
| 357 | + "templateTimelineVersion": 2, |
| 358 | + "dateRange": { |
| 359 | + "start": 1587370079200, |
| 360 | + "end": 1587456479201 |
| 361 | + }, |
| 362 | + "savedQueryId": null, |
| 363 | + "created": 1587473119992, |
| 364 | + "createdBy": "casetester", |
| 365 | + "updated": 1691408702104, |
| 366 | + "updatedBy": "elastic", |
| 367 | + "timelineType": "template", |
| 368 | + "status": "active", |
| 369 | + "sort": [ |
| 370 | + { |
| 371 | + "sortDirection": "desc", |
| 372 | + "columnId": "@timestamp" |
| 373 | + } |
| 374 | + ], |
| 375 | + "eventIdToNoteIds": [], |
| 376 | + "noteIds": [], |
| 377 | + "notes": [], |
| 378 | + "pinnedEventIds": [], |
| 379 | + "pinnedEventsSaveObject": [] |
| 380 | + } |
| 381 | + } |
| 382 | + } |
| 383 | +} |
| 384 | +-------------------------------------------------- |
0 commit comments