Quantcast
Channel: VMware Communities : Discussion List - VMware {code}
Viewing all articles
Browse latest Browse all 2738

instant clone suing REST API

$
0
0

Hi everyone.

 

I'm trying to find a way to clone a VM using REST API in vcenter 6.7.

 

I'm experimenting using POSTMAN from an example from this URL
REST API - instant_clone

 

It seems perhaps there may be some bugs or errors. I keep getting errors following this example, but it's the only one i can find on using the instant clone feature.

 

I've only included the mandatory attributes in the JSON code provided for use in postman.

 

I've also discovered that If i don't include the attibute Guest_OS then i receive unexpected errors that are not even menntioned in the linked article above, almost as if VMware are unaware of this error.

 

{

    "spec": {

        "bios_uuid": "test4",

        "disconnect_all_nics": true,

        "name": "string",

        "guest_OS": "UBUNTU_64",

        "source": "vm-45"

    }

}

 

 

And I continue to receive errors..

 

 

{

 

   "type": "com.vmware.vapi.std.errors.unexpected_input",

   "value": {

   "messages": [

  {

   "args": [

   "[action]",

   "operation-input"

  ],

   "default_message": "Found unexpected fields [action] in structure 'operation-input'.",

   "id": "vapi.data.structure.field.unexpected"

  }

  ]

  }

}

 

i've tried filling in all the fields mentioned in this article, but had no success or any luck trying to find the problem.

 

I've been looking for about 7 hours now and can't find any helpful documentation.  All i would like to do is just find a simple piece of working json code that will create a clone of a VM if posted to vcenter. And yes authentication with session ID is working..

 

This is a sample of the full code if all fields are used, and as mentioned above, there appears to already be one missing field from this example published by vmware.

 

 

{
     "spec": {
         "bios_uuid": "string",
         "disconnect_all_nics": true,
         "name": "string",
         "nics_to_update": [
             {
                 "key": "obj-103",
                 "value": {
                     "allow_guest_control": true,
                     "backing": {
                         "distributed_port": "string",
                         "network": "obj-103",
                         "type": "STANDARD_PORTGROUP"
                     },
                     "mac_address": "string",
                     "mac_type": "MANUAL",
                     "start_connected": true,
                     "upt_compatibility_enabled": true,
                     "wake_on_lan_enabled": true
                 }
             }
         ],
         "parallel_ports_to_update": [
             {
                 "key": "obj-103",
                 "value": {
                     "allow_guest_control": true,
                     "backing": {
                         "file": "string",
                         "host_device": "string",
                         "type": "FILE"
                     },
                     "start_connected": true
                 }
             }
         ],
         "placement": {
             "datastore": "obj-103",
             "folder": "obj-103",
             "resource_pool": "obj-103"
         },
         "serial_ports_to_update": [
             {
                 "key": "obj-103",
                 "value": {
                     "allow_guest_control": true,
                     "backing": {
                         "file": "string",
                         "host_device": "string",
                         "network_location": "http://myurl.com",
                         "no_rx_loss": true,
                         "pipe": "string",
                         "proxy": "http://myurl.com",
                         "type": "FILE"
                     },
                     "start_connected": true,
                     "yield_on_poll": true
                 }
             }
         ],
         "source": "obj-103"
     }
}

 

 

 

 

 

 

if anyone could help i'd really appreciate it.

 

Thankyou very much.


Viewing all articles
Browse latest Browse all 2738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>