API

Welcome to the Nutanix NEXT community. To get started please read our short welcome post. Thanks!

cancel
Showing results for 
Search instead for 
Did you mean: 

Rest api for creating vm from image services not working

SOLVED Go to solution
Adventurer

Rest api for creating vm from image services not working

can anyone help me with sample rest api for creating  a vm from available service images.

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Nutanix Employee

Re: Rest api for creating vm from image services not working

@hiteshhapani

 

Try this.

URLhttps://server_ip:9440/PrismGateway/services/rest/v2.0/vms

 

Body:

{
"name":"VM_name",
"memory_mb":1024,
"num_vcpus":1,
"description":"",
"num_cores_per_vcpu":1,
"vm_disks":[
{
"is_cdrom":false,
"disk_address":{
"device_bus":"scsi"
},
"vm_disk_clone":{
"disk_address":{
"vmdisk_uuid":"3fc43450-fcda-44c2-9c68-15963e7cd665"
}
}
}
]
}

 

"vmdisk_uuid" is the uuid of the image created in AHV. To get the "vmdisk_uuid" perform a GET operation.

 

https://server_ip:9440/PrismGateway/services/rest/v2.0/images/

 

Tags (3)
3 REPLIES
Nutanix Employee

Re: Rest api for creating vm from image services not working

@hiteshhapani

 

Try this.

URLhttps://server_ip:9440/PrismGateway/services/rest/v2.0/vms

 

Body:

{
"name":"VM_name",
"memory_mb":1024,
"num_vcpus":1,
"description":"",
"num_cores_per_vcpu":1,
"vm_disks":[
{
"is_cdrom":false,
"disk_address":{
"device_bus":"scsi"
},
"vm_disk_clone":{
"disk_address":{
"vmdisk_uuid":"3fc43450-fcda-44c2-9c68-15963e7cd665"
}
}
}
]
}

 

"vmdisk_uuid" is the uuid of the image created in AHV. To get the "vmdisk_uuid" perform a GET operation.

 

https://server_ip:9440/PrismGateway/services/rest/v2.0/images/

 

Tags (3)
Adventurer

Re: Rest api for creating vm from image services not working

Thanks @sandeepmp it worked fine. 

Tags (3)
Highlighted
Nutanix Employee

Re: Rest api for creating vm from image services not working

@hiteshhapani

 

Great!!!

 

Note: Please mark the post as resolved, if your queries are answered.

Tags (3)