You are here: Customers and Contacts > isDuplicateCustomerName

Check Duplicate Customer Names

Description

Checks if a customer name is duplicate or not.

Default Protocol Method Type URI
HTTPS GET isDuplicateCustomerName.xml

GET Parameters

Parameter Description Valid Values Optional
customerName Customer name. String No

Sample Code

import java.io.IOException;
import java.net.URLDecoder;

//..............................
//..............................
//..............................
import org.apache.http.params.HttpParams;
public class EMSSample {
            private static DefaultHttpClient httpclient = new DefaultHttpClient();
            private static Principal principal = null;
            private static StringBuffer query;
            //..............................
            //..............................
            //..............................
public static String isDuplicateCustomerName.xml()throws Exception  {
    if(!verifyLogin()){
            return "login failed";
    }
    HttpContext context = new BasicHttpContext();
    context.setAttribute(ClientContext.USER_TOKEN, principal);
         HttpGet get = new HttpGet("https://localhost:8443/ems/3.6/isDuplicateCustomerName.xml");
    query = new StringBuffer();
    setParameter("customerName", "ashwini");
    get.setURI(new URI(URLDecoder.decode(get.getURI() + query.toString(),"UTF-8")));
    HttpResponse response = httpclient.execute(get, 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);
            }
    static void setParameter(String key, String value) {
            if (query.toString().equals("")) {
                        query.append("?" + key + "=" + value + "&");
            } else {
                        query.append(key + "=" + value + "&");
            }
    }
    }
      

Sample Response

<emsResponse>
  <exist>true</exist>
  <stat>ok</stat>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
101 You are not authorized to use this service.
107 An internal error occurred! Please report the error to System administrator.
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.