Automation requests through REST API


#1

I tried to launch automation requests through the REST API and I get the following error message when making a POST request :

The GET request also replies with an error message :

I probably missed something. Here is my code,inspired by the REST API Reference:

#!/usr/bin/env ruby
    
require 'rubygems'
require 'httpclient'

http = HTTPClient.new
http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
url = "https://#{host}/automation_requests"
http.set_auth(url, "admin", "smartvm")

post_data = {
  "version" => "1.1",
  "uri_parts" => {
    "namespace" => "System",
    "class" => "Requets",
    "instance" => "InspectME",
    "message" => "create"
  },
  "parameters" => {
    "var1" => "xxxxxx",
    "var2" => "yyyyyy",
    "var3" => 1024,
    "var4" => false,
    "var5" => "last_value"
  },
  "requester" => {
    "user_name" => "jdoe",
    "auto_approve" => true
  }
}

http.post(url, post_data, {"Accept" => "application/json"}).content

Or maybe automation requests are not yet available through REST API.


#2

That is correct. They should be available via the /api/automation_requests URL (both GET and POST). A GET of /api would show automation_requests as a valid collection.

Support for that was merged to upstream on July 30th, sha# d5a6f6fd.
You would see automation_requests in the config/api.yml file.

Can you double check the date of your appliance as well as the /var/www/miq/vmdb/config/api.yml file there ?


#3

So I might upgrade my appliance: git log reports that the last commit is dated of July 14th.
Would a git pull be enough ?


#4

That should do the trick, main thing is that both code and config/api.yml get updated.