Submitting automation requests through the REST API


#1

When playing with the REST API to submit automation requests, I had a “wouldn’t it be nice if” moment…

…that if the API returned an href to my submitted request, I could poll/query the href to get the eventual status of the automation task.

Anyone else agree, or am I missing something obvious?

Thanks,
pemcg


#2

So, I just tried to make request and I received a response:

{u'results': [{u'approval_state': u'approved',
   u'created_on': u'2015-03-30T07:31:36Z',
   u'description': u'Automation Task',
   u'destination_id': None,
   u'destination_type': None,
   u'fulfilled_on': None,
   u'id': 2,
   u'message': None,
   u'options': {u'attrs': {u'userid': u'admin',
     u'var1': u'xxxxx',
     u'var2': u'yyyyy',
     u'var3': 1024,
     u'var4': True,
     u'var5': u'last value'},
    u'class_name': u'Request',
    u'instance_name': u'InspectME',
    u'message': u'create',
    u'namespace': u'System',
    u'user_id': 1},
   u'request_state': u'pending',
   u'request_type': u'automation',
   u'requester_id': 1,
   u'requester_name': u'Administrator',
   u'source_id': None,
   u'source_type': None,
   u'status': u'Ok',
   u'type': u'AutomationRequest',
   u'updated_on': u'2015-03-30T07:31:36Z',
   u'userid': u'admin'}]}

I used the request from https://github.com/ManageIQ/guides/blob/master/rest_api/examples/automation_request.md

I see an ID there so it should not be difficult at all to get the request from the API.

Milan Falešník, QE