VMware {code} Community
Gregi44
Contributor
Contributor

ERROR CURL post to VCO syntactically incorrect

Hi,

I'm trying to execute a workflow VCO from a php interface (the workflow is to create a VM)

Theire is the code i using :

        $data1 = array (

          "name"  => array("strDatacenter","strcustomize","strfolder","strhostname","IDTimeZone","strdatastoreName","strnetworkname","strvmToCloneName","name","intMemoryGB","intNumCPU","NumCoresPerSocket","ipAddress","subnetMask","dnsServerList","gateway","arrConfigDisk"),

          "type" => array("string","string","string","string","number","string","string","string","string","number","number","number","string","string","Array/string","Array/string","Array/CompositeType(diskname:string,diskletter:string,disksizegb:number,thinProvisioned:boolean,diskpersistence

:string,diskdatastore:string):name"),

          "value"   => array("ALE","CS_W2K8R2","IT VMs","*****","105","*****","vlan_it","TMP_W2K12R2_STD_x64","****","2","1","1","192.168.0.79","255.255.255.0","#{#string#*****#;#string#*****#}#","#{#string#****#}#","#{#CompositeType(diskletter:string,diskname:string,disksizegb:number,thinProvisioned:boolean,diskpersistence:string,diskdatastore:string):name##[#diskname#=#string#ezfzef#+#diskletter#=#string#E:#+#disksizegb#=#number#50.0#+#thinProvisioned#=#boolean#true#+#diskpersistence#=#string#persistent#+#diskdatastore#=#string#*****#]##}#")

          );

        function post_page($path,$data){

          $c = curl_init();

          $curlOptions = array(

           CURLOPT_URL           => $path,

           CURLOPT_SSL_VERIFYPEER => 0,

           CURLOPT_SSL_VERIFYHOST => 0,

           CURLOPT_USERPWD        => "vcoadmin:vcoadmin",

           CURLOPT_RETURNTRANSFER => true,

           CURLOPT_HEADER => false,

           CURLOPT_POST => true,

           CURLOPT_POSTFIELDS => $data,

           CURLOPT_HTTPHEADER => array('Content-Type: application/json')

         );

         curl_setopt_array($c, $curlOptions);

          $output = curl_exec($c);

          if($output === false){

            trigger_error('Erreur curl : '.curl_error($c),E_USER_WARNING);

          }else{

            var_dump($output);

          }

          curl_close($c);

        }

        $sXML = post_page('https://vco_ip:8281/vco/api/workflows/de671563-7d4f-436c-a2e8-e625d355256f/executions',$data1);

I can't find in VCO how to get an exemple of the syntax for this worflow.

Thanks for your help.

Regards.

Tags (3)
0 Kudos
1 Reply
daphnissov
Immortal
Immortal

Is this vCO or vRO? Regardless, it's probably best to put it in the vRO sub-forum.

0 Kudos