52 lines
1.2 KiB
Plaintext
52 lines
1.2 KiB
Plaintext
[[api-rest-activate-watch]]
|
|
==== Activate Watch API
|
|
|
|
A watch can be either <<watch-active-state, active or inactive>>. This API enables
|
|
you to activate a currently inactive watch.
|
|
|
|
The status of an inactive watch is returned with the watch definition
|
|
when you call the <<api-rest-get-watch, Get Watch API>>:
|
|
|
|
[source,json]
|
|
--------------------------------------------------
|
|
GET _watcher/watch/<watch_id>
|
|
--------------------------------------------------
|
|
// AUTOSENSE
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
"_status": {
|
|
"state" : {
|
|
"active" : false,
|
|
"timestamp" : "2015-08-20T12:21:32.734Z"
|
|
}
|
|
"actions": {
|
|
...
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
|
|
You can activate the watch by executing the following API call:
|
|
|
|
[source,json]
|
|
--------------------------------------------------
|
|
PUT _watcher/watch/<watch_id>/_activate
|
|
--------------------------------------------------
|
|
// AUTOSENSE
|
|
|
|
The new state of the watch is returned as part of its overall status.
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
"_status": {
|
|
"state" : {
|
|
"active" : true,
|
|
"timestamp" : "2015-09-04T08:39:46.816Z"
|
|
}
|
|
"actions": {
|
|
...
|
|
}
|
|
}
|
|
}
|
|
-------------------------------------------------- |