API - Activate User

Activate User Account

This API can be used to activate a user's account which is inactive. 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

userService.do

 

Parameter 2 - UserName

Username of any site administrator

 

Parameter 3 - Request Parameters

Name Value
dispatch activate
userName, id or openId is required
userName jdoe
id a570e68e-2134-11e6-b63c-6ce229284b01
openId openId can be used to uniquely identify the user (this field can be used as a custom unique key)

 

Response

1. Response on successfully activating (or user already active)

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<response code="0">
    <msgs>
         <msg>
             <code>0092</code>
             <value><![CDATA[Activated successfully.]]></value>
         </msg>
    </msgs>

</response>

 

2. Response on invalid user id / name

HTTP Response Code = HttpServletResponse.SC_NOT_FOUND

Response XML

<response code="-1">
    <msgs>
         <msg>
             <code>0004</code>
             <value><![CDATA[Unable to find User with matching id]]></value>
         </msg>
    </msgs>
</response>

 

3. Response for unauthorized access

HTTP Response Code = HttpServletResponse.SC_UNAUTHORIZED

Response XML

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

 

Code Snippet

    /*  Check API Call for detail generic code */
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("userName", "jdoe");

    parameters.put("dispatch", "activate");
 
    String retStr = connection.invokeApi("userService.do", "chenry", parameters);
    System.out.println(retStr);
   


Rating: