68 lines
1.3 KiB
Plaintext
68 lines
1.3 KiB
Plaintext
[[watcher-api-get-watch]]
|
|
=== Get Watch API
|
|
|
|
This API retrieves a watch by its id.
|
|
|
|
The following example gets a watch with `my-watch` id:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
GET _xpack/watcher/watch/my_watch
|
|
--------------------------------------------------
|
|
// CONSOLE
|
|
// TEST[setup:my_active_watch]
|
|
|
|
Response:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"found": true,
|
|
"_id": "my_watch",
|
|
"_status": { <1>
|
|
"version": 1,
|
|
"state": {
|
|
"active": true,
|
|
"timestamp": "2015-05-26T18:21:08.630Z"
|
|
},
|
|
"actions": {
|
|
"test_index": {
|
|
"ack": {
|
|
"timestamp": "2015-05-26T18:21:08.630Z",
|
|
"state": "awaits_successful_execution"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"watch": {
|
|
"input": {
|
|
"simple": {
|
|
"payload": {
|
|
"send": "yes"
|
|
}
|
|
}
|
|
},
|
|
"condition": {
|
|
"always": {}
|
|
},
|
|
"trigger": {
|
|
"schedule": {
|
|
"hourly": {
|
|
"minute": [0, 5]
|
|
}
|
|
}
|
|
},
|
|
"actions": {
|
|
"test_index": {
|
|
"index": {
|
|
"index": "test",
|
|
"doc_type": "test2"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:21:08.630Z"/"timestamp": "$body._status.state.timestamp"/]
|
|
<1> The current status of the watch
|