Help in Rest API to create instance.
Hi, I am new to Openstack and REST API automation. Could someone please let me know how to convert the below command to REST API? Thanks in Advance.
CLI command to create instance. I need equivalent in rest API.
nova boot --flavor m1.tiny --image cirros-0.3.4-x86_64-uec --nic net-id=531a7856-5d85-45c2-845a-4926cb7f1ed3 --security-group default demo-instance1
I have written rest api for getting the token, flavor-list, image-list, net-list. I want to know, how to create instance using rest api.
Something like below format:
print
print
print "---------------List of NOVA API-v2 details ---------------"
headers = {
'Content-Type' : 'application/json',
'Accept' : 'application/json',
'X-Auth-Token' : mytoken
}
#### Build the URL
CMDpath="/v2"
APIport=NOVAport
url="http://"+hostIP+":"+APIport+CMDpath
print "URL: ",url
#### Send the GET request
# Note that the second parameter which normally carries the body data
# is "None", making the request a "GET" instead of a "POST"
req = urllib2.Request(url,None, headers)