Log In To Vcenter Chargeback Server - 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

vCenter Chargeback API Programming Guide

Log In to vCenter Chargeback Server

To start using vCenter Chargeback APIs, you must log in to vCenter Chargeback server. 
To log in to vCenter Chargeback
1
Call the Login API by using the following syntax.
<HTTP_request_method> <Base_URL>/login
For example, you can define a call as follows: 
POST https://123.123.123.123/vCenter-CB/api/login
2
(Optional) Use the URL parameter version to specify the API version that you want to call.
3
In the request XML for this API, you can specify the following login details.
User type
User name
Password
LDAP server ID or LDAP server name
The following is an example request XML file.
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0">
<Users>
</Users>
<!-- For Ldap Users -->
<LdapServers>
</LdapServers>
</Request>
If the login succeeds, the API returns a response XML that indicates whether the user is authenticated.
The following is an example program that calls the API.
/**
* This method is for Login to vCenter-ChargeBack
*
* @param requestFilePath
* @param baseURL
* @param version
* @throws IOException
* @throws JDOMException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws HttpException
*/
public static void sampleLoginMethod(String requestFilePath, String baseURL, String
PostMethod post = null;
NameValuePair[] parameters = {new NameValuePair("version", version)};
Document requestDocument = CommonUtil.getXMLDocument(requestFilePath);
String bodyString = CommonUtil.xmlAsString(requestDocument);
HttpClient client = new HttpClient();
14
<User>
<Type>userType</Type>
<Name>administrator</Name>
<Password>vmware</Password>
<!-- For LDap User you can either provide LdapServer id or ldap server name
-->
<LdapServer id="1"/>
</User>
<LdapServer>
<LdapServerName>vmw</LdapServerName>
</LdapServer>
version) throws IOException, JDOMException,
NoSuchAlgorithmException, KeyManagementException, HttpException {
VMware, Inc.

Advertisement

Table of Contents
loading

Table of Contents