You are here: Customers and Contacts > createCustomer

Create Customer

Description

Create a customer with the given parameters.

Default Protocol Method Type URI
HTTPS POST createCustomer.xml

Post Parameters

Parameter Description Valid Values Optional
customerName Specify the customer name. String No
isEnabled

Specify if the customer is to be enabled.

Valid values are True or False.

Boolean No
customerRefIdType

Type of customer reference ID. The parameter values are case-insensitive. You can enter one of the following:

  • guid: A random Globally Unique Identifier (GUID) is generated for the customer.
  • autoIncrement: A unique value is generated by incrementing the last Customer Ref ID.

You can leave the field blank if you want to specify the customer reference ID manually.

String Yes
customerRefId The unique reference ID of the customer. You can enter it manually if customerRefIdType is left blank. String Yes
refId Reference ID. String Yes
description Description of the customer. String Yes
timeZoneId

ID of the time zone in which the customer belongs. This ID is retrieved from the output of timezonelist.xml Web service.

In absence of the timeZoneId parameter, the GMT time zone is set for a customer.

Integer (0 to 100) Yes

Sample Code

import java.io.IOException;
//..............................
//..............................
//..............................
import org.apache.http.params.HttpParams;
public class EMSSample {
private static DefaultHttpClient httpclient = new DefaultHttpClient();
private static Principal principal = null;
//..............................
//..............................
//..............................
public static String createCustomer.xml()throws Exception {
if(!verifyLogin()){
return "login failed";
}H
ttpContext context = new BasicHttpContext();
context.setAttribute(ClientContext.USER_TOKEN, principal);
HttpPost post = new HttpPost
("https://localhost:8443/ems/3.5/createCustomer.xml");
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("customerName", "sample"));
nvps.add(new BasicNameValuePair("customerRefIdType", "guid"));
nvps.add(new BasicNameValuePair("description", "sampleCust"));
nvps.add(new BasicNameValuePair("refId", "ref-1"));
nvps.add(new BasicNameValuePair("isEnabled", "true"));
nvps.add(new BasicNameValuePair("timeZoneId", "38"));
post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
HttpResponse response = httpclient.execute(post, context);
HttpEntity entity = response.getEntity();
byte[] b = null;
if (entity != null) {
long l = entity.getContentLength();
b = new byte[(int) l];
entity.getContent().read(b);
entity.consumeContent();
}return new String(b);
}
}

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<emsResponse>
   <customerId>1</customerId>
   <stat>ok</stat>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
100 Invalid request parameter.
101 You are not authorized to use this service.
107 An internal error occurred! Please report the error to System administrator.
113 Specify a valid Boolean value for {field}. Valid values are true or false. [Note: This error code is applicable for the fields - fetchCompleteEID, loginAllowed, isEnabled, vmEnabled, clonePotection, and optional.].
118 {field} should be of data type integer. [Note: This error code is applicable for the fields - featureId, License modelId, entId, ftrId, customerId, lmId, templateType, lineItemId, CustomerId, stationCount, status, and granularity.]
120 {field} value is less than the minimum permitted value {value}. [Note: This error code is applicable for the fields - productd, featureId,entId, billType, lmId, lastModified, timeZoneId, customerId, and granularity.]
122 {field} is a required field and should have a not null value. [Note: This error code is applicable for the fields - Eid, namespaceName, featureName, startDate, endDate, userIds, featureId, productName, productVersion, detailsLM, lmId, templateType, customAttribute, lineItemId, customerRefId, granularity, loginId, oldPassword, and newPassword.]
132 The URL address does not exist.
531 Customer CRMId {actual Value} already exists. Try again with a different CRMId.
1081 Invalid Web service version provided
1084 No Web service version provided
1088 The EMS system is running on HTTPS. Please provide the correct Web service URL.
1089 Invalid TimeZone Id provided “Id”.
1165 Invalid customerRefIdType. Enter 'guid' or 'autoIncrement'.
1166 CustomerRefId should be blank with guid or autoIncrement option.