Add Members to a Course
Table of Contents
Note: Applicable to all services except Zoho Creator.
Overview
The zoho.learn.addMembersToCourse task adds members to a specific course.
Scope
ZohoLearn.course.UPDATE
Syntax
<response>=zoho.learn.course.addMembers(<portalUrl>,<courseId>,<params>,<connection>);
where:
| Parameter | Data Type | Description |
| <response> | KEY-VALUE | The response returned contains the status of the member addition operation. |
| portalUrl | TEXT | The URL of the hub/network (portal) in Zoho Learn. |
| courseId | TEXT | The ID of the course to which members need to be added. Course ID can be fetched from Get course API; here, id from the response represents the course ID. |
| params | KEY-VALUE (Map) | A map containing the following keys:
|
| connection | TEXT | The connection link name created for this service. A Zoho OAuth connection with the scope ZohoLearn.course.UPDATE must be configured. |
Example
The following script adds members to a course with the specified role:
response=zoho.learn.course.addMembers("zylker","12361400",{"userIds":{799705135}},"learnconnection");
where:
| response | The KEY-VALUE response variable that holds the course details. |
| zylker | The TEXT representing the URL of the hub/network. |
| 12361400 | The TEXT representing the ID of the course in which members need to be added. |
| "userIds":{799705135} | The KEY-VALUE variable containing the user IDs and the role to be assigned. |
| learnconnection | The connection link name in TEXT format. |
Response Format
Success Response
The success response will be returned in the following format:
{ "STATUS": "OK", "DATA": [ { "role": "MEMBER", "name": "Ben Taylor", "colorIndex": "1", "emailId": "taylor@zylker.com", "id": "799705135", "type": "MEMBER", "learnerCourseStatus": "INPROGRESS", "status": "ACTIVE", "learnerCourseProgress": "8.33375" } ] }
Failure Response
The failure response for an invalid course ID will be returned in the following format:
{ "result": "failure", "reason": "Course is invalid.", "errorCode": "237" }