List Coupons
This API is used to get list of coupons for a group by specifying the path to the group or id.
Path syntax is as follows:
Path = segment/segment/......
segment = * | {code: "group code"} | {name: "group name"}
Each segment can contain * (matches any group at that level), name of the group or code of the group. Path must result in single group otherwise the API will fail.
Example of Path
Path = {name:"Training"}/{name: "Corporate"}/{name: "Sales"}
Path = {name:"Training"}/{name: "Corporate"}/*
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
couponService.do
Parameter 2 - UserName
Username of the site admin
Parameter 3 - Request Parameters
Name | Value |
dispatch | listCoupons |
xml | true |
authCode | Coupon name (optional) |
type |
Coupon type (optional). Must be from one of the below values - USAGE - AMOUNT - PERCENT - TOTAL_AMOUNT |
entityType |
entityType should be set to one of the following values - SITE (to create coupon that is valid for all items in the site) - PROGRAM_SESSION (to create coupon that is valid for a program session) - COURSE_SESSION (to create coupon that is valid for a course session) - EVENT (to create coupon that is valid for an event) - GROUP (to create coupon that is valid for everything available in a group) |
entityId |
Id of the above entity. In case entityType is SITE, this value is optional. If not passed, current site id is assumed. In case of multi site enabled accounts, pass the value of any site id from your own account. You can also pass url of the site instead of Id in this parameter (if id is not known) In case entityType is GROUP, ID or the path should be passed |
expFromDate |
Search for coupon that has expiration date equal or after this date represented as epoch time in milliseconds - number of milliseconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds |
expToDate | Search for coupon that has expiration date equal or before this date |
ownerGroupId | ID or path of the authorized group which can use this coupon |
expired |
Boolean (true | false) Find coupons that are expired |
fullyUsed |
Boolean (true | false) Find coupons that are fully used |
currPage | page number to fetch, must be specified for 2nd page onwards. Value of currPage starts with 0. So for page 2 specify currPage = 1 |
numItems | total records in the list, must be specified for 2nd page onwards. You can get the count of records from response of first page. then pass it as-is in subsequent pages. |
pageSize | Number of items in a page |
Response
Response on successfully getting the coupon list
HTTP Response Code = HttpServletResponse.SC_OK
Response XML
<response code="0">
<msgs>
<msg>
<code>0</code>
<value>
<![CDATA[Success]]>
</value>
</msg>
</msgs>
<data>
<coupons numItems=".." currPage=".." pageSize="10">
<coupon id="e48b628e-c31b-11e1-a74c-e96024937694" couponType="USAGE" setMembershipExpiration="false" addUserToCouponsGroup="false" requireApproval="false" previewAccessOnly="false" status="ACTIVE">
<couponName><![CDATA[customer1-free]]></couponName>
<entityType>GROUP</entityType>
<entityId>3873a19c-8567-11e6-ab59-17c08040c106</entityId>
<authorizedGroup>3fb2ebb6-8567-11e6-ab59-17c08040c106</authorizedGroup>
<authorizedGroupName>customer1</authorizedGroupName>
<expDate>1495163497116</expDate>
<valueCount>999999</valueCount>
<usageCount>15</usageCount>
<comments><![CDATA[free coupon for customer1]]></comments>
</coupon>
...
...
...
</coupons>
</data>
</response>
Code Snippet
/* Check API Call for detail */
System.out.println(result);
parameters.put("dispatch", "listCoupons");
parameters.put("xml", String.valueOf(true));
parameters.put("ownerGroupId", "{name:\"Training\"}/{name: \"Corporate\"}/{name: \"Sales\"}");
}
Related Pages
Group Management
Javascript
- Customization On Payment Page
- Validate IP Address while accessing the course
- UI Customization JavaScript Functions
- Verify Custom properties during Test Taking
- Verifying User Properties During Test
- JS Example
- example_custom_scripts
- Test Taking - Customization using callback mechanism
- Cms Calendar Example
Reports
Enrollment Management
- API - Update Event Subscription
- API - Create ExamTestInstance
- Update Program Member - via Program Session Id
- Update Program Member
- API - Self Enroll in Course Session
- Update Course Session Member
- API - Self Enroll in Program Session
- API - Self Enroll in Event
- API - Enroll Users in Course Session
- API - Enroll Users in Program Session
- API - Enroll Users in Event
- API - Enroll Users in Program
Other
Introduction
Report
- Get Sites Metadata
- Get Open Learning Items List
- API - Program Enrollment Summary
- API - Course Enrollment Summary
- Get Catalog Items List
- API - Course Session Members list
- API - Program Members List
- Event participants list
- Api - Test Attempts (Test Instances) List
- Test instance details list
- Api - Non Subscribed Event List
- Api - Subscribed Event List
- API - List All Report Schedules
- API - Get Latest Report Content For A Given Schedule ID
- API - Get Report Content For A Given Report ID
- API - List Reports For A Given Schedule
User Management
- API - User list
- API - Get user details
- Api - User Creation
- API - Create User (With Custom Properties)
- API - Update User
- API - Rename User
- API - Add user to group(s)
- API - Remove user from group(s)
- Merge User Accounts
- API - Activate User
- API - Deactivate User
- API - Change User's Origin Site
- Api - User Login (Creating User Session)
eCommerce
API Documentation
Examples
- User Creation
- User Update
- User List
- Get User Details
- Add User to Group(s)
- Remove User from Group(s)
- User Activate
- User Deactivate
- User Login
- Group List
- Group Membership
- Course Subscription(Coupon Code)
- Subscribed Events List
- Non Subscribed Events List
- Test Instances in Microsite
- Forum APIs
- Javascript Example
Client Example
Quick Links
- Home
- Getting Started
- Knowledgebase
- Video Tutorials
- Google Apps Integration
- Gilly (Plugin for Atlassian Confluence)
Group Management
Javascript
- Customization On Payment Page
- Validate IP Address while accessing the course
- UI Customization JavaScript Functions
- Verify Custom properties during Test Taking
- Verifying User Properties During Test
- JS Example
- example_custom_scripts
- Test Taking - Customization using callback mechanism
- Cms Calendar Example
Reports
Enrollment Management
- API - Update Event Subscription
- API - Create ExamTestInstance
- Update Program Member - via Program Session Id
- Update Program Member
- API - Self Enroll in Course Session
- Update Course Session Member
- API - Self Enroll in Program Session
- API - Self Enroll in Event
- API - Enroll Users in Course Session
- API - Enroll Users in Program Session
- API - Enroll Users in Event
- API - Enroll Users in Program
Other
Introduction
Report
- Get Sites Metadata
- Get Open Learning Items List
- API - Program Enrollment Summary
- API - Course Enrollment Summary
- Get Catalog Items List
- API - Course Session Members list
- API - Program Members List
- Event participants list
- Api - Test Attempts (Test Instances) List
- Test instance details list
- Api - Non Subscribed Event List
- Api - Subscribed Event List
- API - List All Report Schedules
- API - Get Latest Report Content For A Given Schedule ID
- API - Get Report Content For A Given Report ID
- API - List Reports For A Given Schedule
User Management
- API - User list
- API - Get user details
- Api - User Creation
- API - Create User (With Custom Properties)
- API - Update User
- API - Rename User
- API - Add user to group(s)
- API - Remove user from group(s)
- Merge User Accounts
- API - Activate User
- API - Deactivate User
- API - Change User's Origin Site
- Api - User Login (Creating User Session)
eCommerce
API Documentation
Examples
- User Creation
- User Update
- User List
- Get User Details
- Add User to Group(s)
- Remove User from Group(s)
- User Activate
- User Deactivate
- User Login
- Group List
- Group Membership
- Course Subscription(Coupon Code)
- Subscribed Events List
- Non Subscribed Events List
- Test Instances in Microsite
- Forum APIs
- Javascript Example
Client Example
Quick Links
- Home
- Getting Started
- Knowledgebase
- Video Tutorials
- Google Apps Integration
- Gilly (Plugin for Atlassian Confluence)