Api - User Creation

User Creation

This API can be used to create one or more users in the microsite. The API is a restrictive one and can be called by an admin of the site only. Any other user trying to invoke this API would result in an error being returned by the API.


API Details

Signature of API call

connection.invokeApi(String uri, String realUserName, Map<String, String> requestParameters);

See details about invoking API in general


Parameter 1 - URI



Parameter 2 - UserName

Username of any site administrator


Parameter 3 - Request Parameters

Name Value
dispatch signup
username_0 charles
firstname_0 Charles
lastname_0 Keith
email_0 ckeith@xyz.org
password_0 userpassword



1. Response on successfully creating users

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<response code="0">
             <value><![CDATA[User(s) added successfully.]]></value>


2. Response on user creation error

HTTP Response Code = HttpServletResponse.SC_NOT_FOUND

Response XML

<response code="-1">
             <value><![CDATA[ serviceuser_0 serviceuser_1 already present. Please rename them]]></value>


3. Response for unauthorized access

HTTP Response Code = HttpServletResponse.SC_UNAUTHORIZED

Response XML

<response code="-1">
             <value><![CDATA[You are not allowed to perform this action.]]></value>


Code Snippet


    /*  Check API Call for detail generic code */
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("dispatch", "signup");
    String retStr = connection.invokeApi("signupService.do", "chenry", parameters);

    private void populateMapForUserCreation(Map<String, String> parameters) {
           parameters.put("username_0", "charles");
           parameters.put("firstname_0", "Charles");
           parameters.put("lastname_0", "Keith");
           parameters.put("email_0", "ckeith@xyz.org");
           parameters.put("password_0", "userpassword");

           parameters.put("username_1", "vbailey");
           parameters.put("firstname_1", "Vivian");
           parameters.put("lastname_1", "Bailey");
           parameters.put("email_1", "vbailey@xyz.org");