API - Enroll Users in Event

Enroll User(s) to Event

This API can be used to enroll users to an event.

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

enrollmentService.do

Parameter 2 - UserName

Username of any site administrator

Parameter 3 - Request Parameters

Name Value
dispatch enrollUsersInEvent
Either usernames or ids is required
eventId program session id to enroll in to
usernames

comma separated usernames

e.g. adoe,bdoe,cdoe,ddoe....

openIds

comma separated Open Ids

eg. test-1232,openid3232

ids

81154232-7e81-11e4-b5ad-fb29daca67a3, xxx-xxx-xxx-xxx-xxx

comma separated user ids

(Optional .. specify either usernames or ids)

sendMail true or false. Send true to send enrollment emails.

customUpdPropMap['property1Name'],

customUpdPropMap['property2Name'],

customUpdPropMap['property3Name']

...

...

Custom property values to be updated at event subscription level. Each property name should be passed as "customUpdPropMap['name of property']"

These custom properties must be first defined in microsite, using the Site Admin->Custom Properties->Event Participant properties.

 

Response

1. Response on successfully adding user to group

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<response code="0">
    <msgs>
         <msg>
             <code>0</code>
             <value><![CDATA[Success]]></value>
         </msg>
    </msgs>

</response>

 

2. 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("eventId", "81154232-7e81-11e4-b5ad-fb29daca67a3");

    parameters.put("usernames", "adoe,bdoe,cdoe");
    parameters.put("dispatch", "enrollUsersInEvent");
   
    String retStr = connection.invokeApi("enrollmentService.do", "chenry", parameters);
    System.out.println(retStr);


Rating: