Synchronous response from Cloudforms



We have an application that is not capable of handling async responses from ManageIQ/Cloudforms. Is there a way to have ManageIQ responde synchronously? To make it more more clear, we’d want to have

url = "https://#{cfserver}/api/automation_requests"
resource =, user, password)
payload = {
“action” => “create”,
“resource” => {
“version” => “1.1”,
“uri_parts” => {
“namespace” => “System”,
“class” => “Request”,
“instance” => “someentry”,
“message” => “create”
“parameters” => {
“vm_name” => “vm1234”
“requester” => {
“auto_approve” => true

make the automation request , and the response object will be populated in the state machine and returned here.

response =, “Content-Type” => “application/json”)
request_result = JSON.parse(response)


@gmccullough can you review this question from @sirvi and forward to a SME if necessary.


@mkanoor Can you help here?


Or perhaps @abellotti ?


If you are running the automation request from a script you can poll for the task till ‘request_state’ is finished.
You would have to get the token and urls for your environment. The sample shows us sleeping 10 seconds before we check the request state
The automation_request.txt file has the data from the following URL

require 'rest_client'

token = "654195d9914302ceb2291946d165eb92" 
url = 'http://localhost:4000/api'
automation_url = "#{url}/automation_requests"

body ='automation_request.txt')
response = => :post,
                                   :url => automation_url,
                                   :payload => body,
                                   :headers => {"X-Auth-Token" => token}).execute

parsed_data = JSON.parse(response.body)
request_id = parsed_data['results'][0]['id']
request_url = "#{automation_url}/#{request_id}"
state = ""
puts "Monitoring #{request_url}"
while state != 'finished' do
  automation_task = => :get,
                                            :url => request_url,
                                            :headers => {"X-Auth-Token" => token}).execute
  parsed_data = JSON.parse(automation_task.body)
  state = parsed_data['request_state']
  puts "Current State #{state}"


If you are trying to do this from inside of Automate you would have to use a state machine and split it into 2 methods

  1. Method 1 Posts the request, stores the request id using $evm.set_state_var(:request_id, id_from_rest_call)

  2. Method 2 does the polling by fetching the id using $evm.get_state_var(:request_id)
    If the request_state is not finished it can set the $evm.root[‘ae_result’] = 'retry’
    If the request state is finished it can set the $evm.root[‘ae_result’] = ‘ok’