Hi, I've a problem with a call to the API for report generation in PHP.
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://xxx.xxx.xxx.xxx/vCenter-CB/api/report?version=2.5");
curl_setopt($curl, CURLOPT_PORT , 8080);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xml'));
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_VERBOSE, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($curl, CURLOPT_POSTFIELDS, $chiamata);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_COOKIE, $cookie);
$response = curl_exec($curl);
The body passed seems correct :
<?xml version="1.0" encoding="UTF-8"?>
<Request>
<Reports>
<Report>
<MetaData>
<Name>SampleReport</Name>
<Description />
<ReportType>COST_REPORT</ReportType>
<OwnedByName />
<ReportPeriod>
<From>1</From>
<To>9999999999999</To>
</ReportPeriod>
<Hierarchies>
<Hierarchy id="132665">
<Entities>
<Entity id="132666" costModelId="931" />
</Entities>
</Hierarchy>
</Hierarchies>
<ComputingResources>
<ComputingResource id="1" />
<ComputingResource id="2" />
<ComputingResource id="5" />
<ComputingResource id="6" />
<ComputingResource id="9" />
<ComputingResource id="10" />
</ComputingResources>
</MetaData>
<Configuration>
<Computation>
<Settings type="costVariance">
<Property name="enabled" value="true" />
<Property name="granularity" value="DAILY" />
</Settings>
</Computation>
</Configuration>
</Report>
</Reports>
</Request>
Using a Rest client , it work with a corrent resonse.
USing this method I receive a 200 OK for the call but the API give me this response :
<?xml version="1.0" encoding="UTF-8"?>
<Response xmlns="http://www.vmware.com/vcenter/chargeback/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" status="failure">
<Error majorErrorCode="500" minorErrorCode="0" message="No such method defined or API call missing required arguments." />
</Response>
any suggestion ?
thanks