Hi,
I would like to build a generic API with Automation Engine.
Followinf @jhardy blog post So I created an instance /System/Request/MyAPI
and when I try to call it, it just keeps calling /System/Event/request_created#create
. I understand that an event is generated when call the REST API, but no data from my request is passed to $evm.root.
I call the API with the following code:
http = HTTPClient.new
http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
uri = "https://cfme001.lab.evenit.info/api/automation_requests"
http.set_auth(uri, 'admin', 'smartvm')
http.www_auth.basic_auth.challenge(uri)
headers = { "Content-Type" => "application/json", "Accept" => "application/json,version=2" }
content = {
:version => '1.1',
:uri_parts => [{
:namespace => 'System',
:class => 'Request',
:instance => 'GenericApi',
:message => 'create'
}],
:parameters => [{
:auto_approve => 'true',
:method => 'helloworld',
:args => {
:arg1 => 'value1',
:arg2 => 'value2',
:arg3 => 'value3'
}
}]
}
puts http.post(uri, content.to_json, headers).content
Any hint ?