3 Replies Latest reply on Sep 3, 2014 12:58 AM by Lakshmi325


    pinky_clouditalia Lurker

      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"?>






      <Description />


      <OwnedByName />






      <Hierarchy id="132665">


      <Entity id="132666" costModelId="931" />





      <ComputingResource id="1" />

      <ComputingResource id="2" />

      <ComputingResource id="5" />

      <ComputingResource id="6" />

      <ComputingResource id="9" />

      <ComputingResource id="10" />





      <Settings type="costVariance">

      <Property name="enabled" value="true" />

      <Property name="granularity" value="DAILY" />









      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." />



      any suggestion ?


        • 1. Re: REST CALL API in PHP
          dprabhakaran Enthusiast
          VMware Employees


            Which version of Chargeback you use? Based on the version in request and response I see a version mismatch!




          • 2. Re: REST CALL API in PHP
            pinky_clouditalia Lurker

            Manager and database version 2.6 . I've tried to call API with version 2.6 but don't work (not supported) . I've tried without specifing the the version (like the call thru Rest client) but always I receive the same 500 error in the API (200 in the API call).

            I've no problem with others calls (GET hierarchies or entities ...).





            P.S. Changed the value for the <To> tag with conversion of the current datetime...

            • 3. Re: REST CALL API in PHP
              Lakshmi325 Novice
              VMware Employees



              One of the reason to get this error is, The request body sending in the API call could be empty. Please verify whether the request is setting properly before sending the API call. I tried with Rest client by passing request as empty and getting the same error.