Here are the details you are looking for. I wrote a simple program for you to illustrate the workflow for the destroyVirtualMachine API call for you.
--- START Script --- #!/usr/bin/env python # Author: Will Stevens (CloudOps) - wstev...@cloudops.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Usage: cli_example.py [--json=<arg>] [--api_key=<arg> --secret_key=<arg>] [options] cli_example.py (-h | --help) Options: -h --help Show this screen. --json=<arg> Path to a JSON config file with the same names as the options (without the -- in front). --api_key=<arg> CS Api Key. --secret_key=<arg> CS Secret Key. --endpoint=<arg> CS Endpoint [default: http://127.0.0.1:8080/client/api]. --poll_interval=<arg> Interval, in seconds, to check for a result on async jobs [default: 5]. --logging=<arg> Boolean to turn on or off logging [default: True]. --log=<arg> The log file to be used [default: logs/cs_api.log]. --clear_log=<arg> Removes the log each time the API object is created [default: True]. --async=<arg> Boolean to specify if the API should wait for async calls [default: False]. """ from csapi import CLI import pprint if __name__ == '__main__': api = CLI(__doc__) # call the constructor with the __doc__ value... res = api.request({ 'command':'destroyVirtualMachine', 'id':'f9066903-8c6a-461e-a25d-536850ed8733' # hard coded example }) pprint.pprint(res) --- END Script --- --- START Command --- $ ./cli_example.py --json=lab.json --- END Command --- --- START Output --- 14-07-2016 10:33:04 PM Starting new HTTP connection (1): 172.16.21.121 14-07-2016 10:33:04 PM "GET /client/api?signature=Y9M%2BhmWOD07DKcAMmdbXHbgkZeU%3D&apiKey=NkWddZlHTHmtq-FU3T7DZCYLv_EVpsQlXED04hJhHLEAwD7udmCfE6QJk4a8i8L2RXJ6pz7MFrWtTsq0ixdDxA&command=destroyVirtualMachine&id=f9066903-8c6a-461e-a25d-536850ed8733&response=json HTTP/1.1" 200 86 14-07-2016 10:33:04 PM GET http://172.16.21.121:8080/client/api?signature=Y9M%2BhmWOD07DKcAMmdbXHbgkZeU%3D&apiKey=NkWddZlHTHmtq-FU3T7DZCYLv_EVpsQlXED04hJhHLEAwD7udmCfE6QJk4a8i8L2RXJ6pz7MFrWtTsq0ixdDxA&command=destroyVirtualMachine&id=f9066903-8c6a-461e-a25d-536850ed8733&response=json 14-07-2016 10:33:04 PM {u'jobid': u'a634eaa0-10d2-486e-ab23-56b18ed1feec'} 14-07-2016 10:33:04 PM 14-07-2016 10:33:04 PM polling... 14-07-2016 10:33:09 PM Starting new HTTP connection (1): 172.16.21.121 14-07-2016 10:33:09 PM "GET /client/api?signature=Nu4kdVWS%2BsRYZMcJGGNEukTAEr4%3D&apiKey=NkWddZlHTHmtq-FU3T7DZCYLv_EVpsQlXED04hJhHLEAwD7udmCfE6QJk4a8i8L2RXJ6pz7MFrWtTsq0ixdDxA&command=queryAsyncJobResult&response=json&jobId=a634eaa0-10d2-486e-ab23-56b18ed1feec HTTP/1.1" 200 423 14-07-2016 10:33:09 PM GET http://172.16.21.121:8080/client/api?signature=Nu4kdVWS%2BsRYZMcJGGNEukTAEr4%3D&apiKey=NkWddZlHTHmtq-FU3T7DZCYLv_EVpsQlXED04hJhHLEAwD7udmCfE6QJk4a8i8L2RXJ6pz7MFrWtTsq0ixdDxA&command=queryAsyncJobResult&response=json&jobId=a634eaa0-10d2-486e-ab23-56b18ed1feec 14-07-2016 10:33:09 PM {u'accountid': u'5303fd19-111a-11e4-8081-067706000062', u'cmd': u'org.apache.cloudstack.api.command.user.vm.DestroyVMCmd', u'created': u'2016-07-14T22:33:04-0400', u'jobid': u'a634eaa0-10d2-486e-ab23-56b18ed1feec', u'jobinstanceid': u'f9066903-8c6a-461e-a25d-536850ed8733', u'jobinstancetype': u'VirtualMachine', u'jobprocstatus': 0, u'jobresultcode': 0, u'jobstatus': 0, u'userid': u'5304b671-111a-11e4-8081-067706000062'} 14-07-2016 10:33:09 PM 14-07-2016 10:33:09 PM polling... 14-07-2016 10:33:14 PM Starting new HTTP connection (1): 172.16.21.121 14-07-2016 10:33:14 PM "GET /client/api?signature=Nu4kdVWS%2BsRYZMcJGGNEukTAEr4%3D&apiKey=NkWddZlHTHmtq-FU3T7DZCYLv_EVpsQlXED04hJhHLEAwD7udmCfE6QJk4a8i8L2RXJ6pz7MFrWtTsq0ixdDxA&command=queryAsyncJobResult&response=json&jobId=a634eaa0-10d2-486e-ab23-56b18ed1feec HTTP/1.1" 200 1789 14-07-2016 10:33:14 PM GET http://172.16.21.121:8080/client/api?signature=Nu4kdVWS%2BsRYZMcJGGNEukTAEr4%3D&apiKey=NkWddZlHTHmtq-FU3T7DZCYLv_EVpsQlXED04hJhHLEAwD7udmCfE6QJk4a8i8L2RXJ6pz7MFrWtTsq0ixdDxA&command=queryAsyncJobResult&response=json&jobId=a634eaa0-10d2-486e-ab23-56b18ed1feec 14-07-2016 10:33:14 PM {u'accountid': u'5303fd19-111a-11e4-8081-067706000062', u'cmd': u'org.apache.cloudstack.api.command.user.vm.DestroyVMCmd', u'created': u'2016-07-14T22:33:04-0400', u'jobid': u'a634eaa0-10d2-486e-ab23-56b18ed1feec', u'jobprocstatus': 0, u'jobresult': {u'virtualmachine': {u'account': u'admin', u'affinitygroup': [], u'cpunumber': 1, u'cpuspeed': 1000, u'cpuused': u'1.34%', u'created': u'2016-07-14T22:24:40-0400', u'details': {u'hypervisortoolsversion': u'xenserver56'}, u'diskioread': 0, u'diskiowrite': 0, u'diskkbsread': 0, u'diskkbswrite': 0, u'displayname': u'delete-vm', u'displayvm': True, u'domain': u'ROOT', u'domainid': u'2560f02d-111a-11e4-8081-067706000062', u'guestosid': u'25f894ca-111a-11e4-8081-067706000062', u'haenable': True, u'hypervisor': u'XenServer', u'id': u'f9066903-8c6a-461e-a25d-536850ed8733', u'instancename': u'i-2-97-VM', u'isdynamicallyscalable': False, u'jobid': u'a634eaa0-10d2-486e-ab23-56b18ed1feec', u'jobstatus': 0, u'memory': 512, u'name': u'delete-vm', u'networkkbsread': 20, u'networkkbswrite': 11, u'nic': [{u'gateway': u'10.1.1.1', u'id': u'181cc746-59a0-4036-964c-e738039e5a98', u'ipaddress': u'10.1.1.185', u'isdefault': True, u'macaddress': u'02:00:1c:4d:00:03', u'netmask': u'255.255.255.0', u'networkid': u'b01c87b8-8a81-4227-a2be-89b4ca5ec6a9', u'networkname': u'test_tier', u'traffictype': u'Guest', u'type': u'Isolated'}], u'passwordenabled': True, u'rootdeviceid': 0, u'rootdevicetype': u'ROOT', u'securitygroup': [], u'serviceofferingid': u'8951127a-df8e-408a-9483-3c0845faa770', u'serviceofferingname': u'1cpu.512MB', u'state': u'Destroyed', u'tags': [], u'templatedisplaytext': u'Ubuntu 14.04 LTS (64bits) - v1.0 - 05/05/2014', u'templateid': u'21075d3d-e221-47c7-9c88-0f97c0909d9c', u'templatename': u'Ubuntu 14.04 LTS', u'zoneid': u'b97e2370-9de5-4f5d-b718-b17a4b59e535', u'zonename': u'curacao'}}, u'jobresultcode': 0, u'jobresulttype': u'object', u'jobstatus': 1, u'userid': u'5304b671-111a-11e4-8081-067706000062'} 14-07-2016 10:33:14 PM --- END Output --- Let us know if you have questions. Cheers, Will