Api - Subscribe to Course Session Using Coupon Code

Subscribe to Course Session Using Coupon Code

This API can be used to subscribe a user to a course session using a valid coupon code. The API can be called by the site user who wants to subscribe through a valid (not already used) coupon code. This API is not concerned about how the user obtains the coupon code. That would be handled by a separate 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

eventService.do

 

Parameter 2 - UserName

Username of any site administrator or course instructor

 

Parameter 3 - Request Parameters

Name Value
dispatch subscribeByAuthCode
eventId EventId of a subscription event for the course session
code A valid coupon code for the course session

 

Response

1. Response on successful subscription

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<response code="0">
    <msgs>
         <msg>
             <code>0153</code>
             <value><![CDATA[Successfully subscribed to the course session]]></value>
         </msg>
    </msgs>
</response>

 

2. Response on error during subscription due to invalid code

HTTP Response Code = HttpServletResponse.SC_NOT_FOUND

Response XML

<response code="-1">
    <msgs>
         <msg>
             <code>0026</code>
             <value><![CDATA[Invalid auth code]]></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("dispatch", "subscribeByAuthCode");
    parameters.put("eventId", eventId);
    parameters.put("code", authCode);
    String retStr = connection.invokeApi("eventService.do", "charles", parameters);
    System.out.println(retStr);

 

 


Rating: