Add A Fixed Cost - VMware VCENTER CHARGEBACK 1.5 - API Manual

Vcenter chargeback api programming guide
Hide thumbs Also See for VCENTER CHARGEBACK 1.5 - API:
Table of Contents

Advertisement

Add a Fixed Cost

A fixed cost is a definite cost that can be charged on an entity. Using the Add Fixed Cost API, you can create 
fixed costs for entities.
To add a fixed cost
1
Call the API using the following syntax.
<HTTP_request_method> <Base_URL>/fixedCost
For example, you can define a call like this: 
POST https://123.123.123.123/vCenter-CB/api/fixedCost
2
In the request XML, specify a name and a description for the fixed cost. 
The following is an example request XML.
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0">
<FixedCosts>
<FixedCost>
</FixedCost>
</FixedCosts>
</Request>
If the task is successful, the API returns an XML file that provides details of the new fixed cost.
The following is an example program that calls the API.
/**
* This method is to add a fixed cost in vCenter-ChargeBack
*
* @param requestFilePath
* @param baseURL
* @throws IOException
* @throws JDOMException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws HttpException
*/
public static void sampleAddFixedCost(String requestFilePath, String baseURL) throws
PostMethod post = null;
Document requestDocument = CommonUtil.getXMLDocument(requestFilePath);
String bodyString = CommonUtil.xmlAsString(requestDocument);
HttpClient client = new HttpClient();
Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new
String uri = "https://" + baseURL + "/vCenter-CB/api/fixedCost";
try {
} finally {
}
}
VMware, Inc.
<Name>Fixed Cost 1</Name>
<Description>Fixed Cost 1 description</Description>
<Currency id="1"/>
IOException, JDOMException, NoSuchAlgorithmException,
KeyManagementException, HttpException {
FakeSSLCertificateSocketFactory(), 443));
post = new PostMethod(uri);
post.setRequestBody(bodyString);
client.executeMethod(post);
System.out.println(post.getResponseBodyAsString());
if (post != null) {
post.releaseConnection();
}
Chapter 2 Understanding the Workflow
19

Advertisement

Table of Contents
loading

Table of Contents