You have to keep polling for the request id until it completes.
curl -X POST -u admin:admin -H 'X-Requested-By:1'
http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests -d
'{"RequestInfo":{"context":"YARN Service
Check","command":"YARN_SERVICE_CHECK"},"Requests/resource_filters":[{"service_name":"YARN"}]}'
{
"href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests/12",
"Requests" : {
"id" : 12,
"status" : "Accepted"
}
}%
curl -X GET -u admin:admin -H 'X-Requested-By:1'
http://c6401.ambari.apache.org:8080/api/v1/clusters/c1/requests/12 | grep
request_status
"request_status" : "COMPLETED",
Thanks,
Alejandro
From: Juanjo Marron <[email protected]<mailto:[email protected]>>
Reply-To: Ambari User <[email protected]<mailto:[email protected]>>,
Juanjo Marron <[email protected]<mailto:[email protected]>>
Date: Thursday, July 9, 2015 at 9:25 AM
To: Ambari User <[email protected]<mailto:[email protected]>>
Subject: REST API operations completed
Hi all,
Is there a backend way to be notified when an Ambari operation (such as running
a service check or restart) has finished?
Or is there a way to run a service check from the backend using REST API
command, but it returns the result of the service check only after it completes?
When using REST API command to run a service check, we are instantly given info
regarding that service check, instead of receiving that info after it completes.
Other then constantly checking that request using a REST API command, is there
a way to know when the Ambari operation has completed?
Thanks for your time