scormcloud-api-wrapper
Node.js client for the SCORM Cloud API.
Installation
To install via npm:
Usage
Construct an instance of the API client with your Application ID and secret key.
Use the authPing
method to verify that your credentials are valid and that the web service is reachable.
Asynchronous functions use error-first callbacks. The first argument is reserved for an error object, and the second for response data.
For more information, see Getting started with the Node.js client for the SCORM Cloud API.
API
Debug Service
.authPing(callback)
Verifies that your credentials are valid and that the web service is reachable.
Parameters:
callback
Course Service
.getCoursePreviewUrl(courseid, [versionid, [redirectUrl]])
Get the preview url for the specified course.
Parameters:
courseid
- The unique identifier for the course.versionid
- The version of the package which will be used. If omitted, use the most recent version.redirecturl
- The redirect url for when the client exits course preview. The following keywords are available:- “closer” - Redirect to a page that automatically tries to close the browser window.
- “blank” - Redirect to a blank page.
- “message” - Redirect to a page with a simple message about the course being complete.
.courseExists(courseid, callback)
Check whether or not the specified course exists.
Parameters:
courseid
- The unique identifier for the course.callback
.deleteCourse(courseid, [options], callback)
Delete the specified course.
Parameters:
courseid
- The unique identifier for the course.options
- Object with optional parameters; see options below.callback
Options:
email
- If this parameter is included, user information will be attached to this event in the event history on the SCORM Cloud website.
.getCourseAttributes(courseid, callback)
Get attributes for the specified course. See Course Attributes.
Parameters:
courseid
- The unique identifier for the course.callback
.setCourseAttributes(courseid, attributes, callback)
Set attributes for the specified course. See Course Attributes.
Parameters:
courseid
- The unique identifier for the course.attributes
- Object with course attributes.callback
.getCourseList([options], callback)
Retrieve a list of courses associated with the appid
.
Parameters:
options
- Object with optional parameters; see options below.callback
Options:
filter
- A regular expression that will be used to filter the list of courses. Specifically only those courses whose courseid’s match the given expression will be returned in the list.tags
- A comma separated list of tags to filter results by. Results will include only courses which are tagged with every tag in the list.
.getCourseDetail(courseid, callback)
Retrieve details about the specified course. Includes version information; see Course Versioning and Overwriting.
Parameters:
courseid
- The unique identifier for the course.callback
.importCourse(courseid, path, callback)
Import a course. If the import is successful, the imported course will be registered using the courseid provided. If the courseid refers to an existing course, a new version of the course will be created; see Course Versioning and Overwriting.
Parameters:
courseid
- The unique identifier for the course.path
- The path for the course to be imported.callback
Registration Service
.createRegistration(courseid, regid, fname, lname, learnerid, [options], callback)
Create a new registration.
Parameters:
courseid
- The course for which this registration is being created.regid
- The id used to identify this registration (must be unique).fname
- The first name of the learner associated with this registration.lname
- The first name of the learner associated with this registration.learnerid
- The learner id associated with this registration.options
- Object with optional parameters; see options below.callback
Options:
email
- If the email parameter is included, this registration will be attached to a SCORM Cloud website user (an “empty” user will be created if none with this email exists).postbackurl
- Specifies a URL for which to post activity and status data in real time as the course is completed. See Registration Postbacks.authtype
- Optional parameter to specify how to authorize against the given postbackurl, can be “form” or “httpbasic”.urlname
- You can optionally specify a login name to be used for credentials when posting to the URL specified in postbackurl.urlpass
- If credentials for the postbackurl are provided, this must be included, it is the password to be used in authorizing the postback of data to the URL specified by postbackurl.resultsformat
- This parameter allows you to specify a level of detail in the information that is posted back while the course is being taken. It may be one of three values: “course” (course summary), “activity” (activity summary, or “full” (full detail), and is set to “course” by default.
.registrationExists(regid, callback)
Check whether or not the specified registration exists.
Parameters:
regid
- The unique identifier for the registration.callback
.deleteRegistration(regid, callback)
Delete the specified registration.
Parameters:
regid
- The unique identifier for the registration.callback
.resetRegistration(regid, callback)
Reset the specified registration.
Parameters:
regid
- The unique identifier for the registration.callback
.getRegistrationList([options], callback)
Retrieve a list of registrations associated with the appid
.
Parameters:
options
- Object with optional parameters; see options below.callback
Options:
courseid
- Limit search to only registrations for the course specified by this courseid.learnerid
- Limit search to only registrations for the learner specified by this learnerid.after
- Return registrations updated (strictly) after this timestamp.until
- Return registrations updated up to and including this timestamp.
.getRegistrationDetail(regid, callback)
Retrieve details about the specified registration.
Parameters:
regid
- The unique identifier for the registration.callback
.getRegistrationResult(regid, [options], callback)
Retrieve details about the results of the specified registration.
Parameters:
regid
- The unique identifier for the registration.callback
.getRegistrationListResults([options], callback)
Combination of getRegistrationList
and getRegistrationResult
methods; can be used for basic reporting functionality.
Parameters:
options
- Object with optional parameters; see options below.callback
Options:
courseid
- Limit search to only registrations for the course specified by this courseid.learnerid
- Limit search to only registrations for the learner specified by this learnerid.after
- Return registrations updated (strictly) after this timestamp.until
- Return registrations updated up to and including this timestamp.
.getLaunchUrl(regid, redirecturl, [options])
Get the launch url for the specified registration
Parameters:
regid
- The unique identifier for the registration.redirecturl
- The redirect url for when the registration has been completed. The following keywords are available:- “closer” - Redirect to a page that automatically tries to close the browser window.
- “blank” - Redirect to a blank page.
- “message” - Redirect to a page with a simple message about the course being complete.
options
- Object with optional parameters; see options below.
Options:
cssurl
- An absolute URL to a custom stylesheet that will be used to style the navigational menus and header of the SCORM “player” that displays the course content.learnerTags
- Comma-delimited list of tags to associate with the learner who is launching the course.courseTags
- Comma-delimited list of tags to associate with the launched course.registrationTags
- Comma-delimited list of tags to associate the the launched registration.disableTracking
- If set to “true”, the registration will be launched with tracking disabled, and the launch will not result in any changes to the registration.
.getLaunchHistory(regid, callback)
Retrieve historical list of launches for the specified registration.
Parameters:
regid
- The unique identifier for the registration.callback
.getLaunchInfo(launchid, callback)
Retrieve historical data for the specified launch.
Parameters:
launchid
- The unique identifier for the launch.callback
.resetGlobalObjectives(regid, callback)
Reset all global objectives associated with this registration.
Parameters:
regid
- The unique identifier for the registration.callback
.updateLearnerInfo(learnerid, fname, lname, [options], callback)
Update learner information that was given during previous createRegistration
calls.
Parameters:
learnerid
- The id of the learner whose information is being updated.fname
- The first name of the learner.lname
- The last name of the learner.options
- Object with optional parameters; see options below.callback
Options:
newid
- The new id to assign to this learner.email
- The email of the learner.
.getPostbackInfo(regid, callback)
This method provides a way to retrieve the postback attributes that were set with createRegistration
or updatePostbackInfo
calls. See Registration Postbacks.
Parameters:
regid
- The unique identifier for the registration.callback
.updatePostbackInfo(regid, postbackUrl, options, callback)
This method provides a way to update the postback settings for a registration created with the createRegistration
call. If you wish to change an authenticated postback to an unauthenticated postback, call this method with only a url specified.
Parameters:
regid
- The unique identifier for the registration.postbackUrl
- URL for registation results to be posted to.options
- Object with optional parameters; see options below.callback
Options:
authtype
- Optional parameter to specify how to authorize against the given postbackurl, can be “form” or “httpbasic”.urlname
- You can optionally specify a login name to be used for credentials when posting to the URL specified in postbackurl.urlpass
- If credentials for the postbackurl are provided, this must be included, it is the password to be used in authorizing the postback of data to the URL specified by postbackurl.resultsformat
- This parameter allows you to specify a level of detail in the information that is posted back while the course is being taken. It may be one of three values: “course” (course summary), “activity” (activity summary, or “full” (full detail), and is set to “course” by default.
.deletePostbackInfo(regid, callback)
Clear postback settings so that registration results no longer invoke a postback url.
Parameters:
regid
- The unique identifier for the registration.callback
.testRegistrationPostbackUrl(postbackUrl, options, callback)
This method provides a way to test a URL for posting registration results back to, as they would be posted when using the postbackurl in the createRegistration call. When called, an example registration result will be posted to the URL given, or else an error will be reported regarding why the post failed.
Parameters:
postbackUrl
- URL for registation results to be posted to.options
- Object with optional parameters; see options below.callback
Options:
authtype
- Optional parameter to specify how to authorize against the given postbackurl, can be “form” or “httpbasic”.urlname
- You can optionally specify a login name to be used for credentials when posting to the URL specified in postbackurl.urlpass
- If credentials for the postbackurl are provided, this must be included, it is the password to be used in authorizing the postback of data to the URL specified by postbackurl.resultsformat
- This parameter allows you to specify a level of detail in the information that is posted back while the course is being taken. It may be one of three values: “course” (course summary), “activity” (activity summary, or “full” (full detail), and is set to “course” by default.
Invitation Service
.createInvitation(courseid, public, [options], callback)
Create a new invitation.
Parameters:
courseid
- The id of the course for which the invitation will be created.public
- A boolean specifying whether the invitation is public or private.options
- Object with optional parameters; see options below.callback
Options:
emailSubject
- The subject of the email that will be sent to any addresses provided (for private invitations).emailBody
- The text that will be sent in the body of emails sent to any addresses provided (for private invitations).addresses
- A comma separated list of email addresses for which registrations will be created for private invitations.send
- A boolean (“true” or “false” only, default “false”) parameter specifying whether the private invitations will be emailed to the provided addresses or not.creatingUserEmail
- The email of the user who is creating the invitation. This value is required in order to send private invitations.registrationCap
- Integer value of limit of public invitation registrations to allow.postbackurl
- Specifies a URL for which to post activity and status data in real time as the course is completed.authtype
- Optional parameter to specify how to authorize against the given postbackurl, can be “form” or “httpbasic”.urlname
- You can optionally specify a login name to be used for credentials when posting to the URL specified in postbackurl.urlpass
- If credentials for the postbackurl are provided, this must be included, it is the password to be used in authorizing the postback of data to the URL specified by postbackurl.resultsformat
- This parameter allows you to specify a level of detail in the information that is posted back while the course is being taken. It may be one of three values: “course” (course summary), “activity” (activity summary, or “full” (full detail), and is set to “course” by default.expirationdate
- The date this invitation will expire and can not be launched (formatted yyyyMMddHHmmss in UTC time).
The following tags can be added to the emailSubject
or emailBody
options:
- [COURSE] - Course name
- [COURSE_DESCRIPTION] - Course description
- [COURSE_DURATION] - Course duration
- [USER] - Recipient’s name
- [URL] - Course launch url
- [URL:name] - Link to the launch URL with text ‘name’
.getInvitationInfo(invitationid, [options], callback)
Retrieve details about the specified invitation.
Parameters:
invitationid
- The unique identifier for the invitation.callback
.getInvitationList([options], callback)
Retrieve a list of invitations that meet the filter criteria.
Parameters:
options
- Object with optional parameters; see options below.callback
Options:
filter
- A regular expression that will be used to filter the list of invitations. Specifically only those invitations whose invitation Id’s match the given expression will be returned in the list.coursefilter
- A regular express that will be used to filter the list of invitations. Specifically only those invitations that are associated with courses whose courseid’s match the given expression will be returned in the list.
Application Service
This service requires authentication with your management app id and secret. You can access this information from the Apps / API page in SCORM Cloud.
.getAppList(callback)
Retrieve a list of applications associated with your realm.
Parameters:
callback
.getAppInfo(appid, callback)
Retrieve details about the specified application.
Parameters:
appid
- The unique identifier for the application.callback
.createApplication(name, callback)
Create a new application.
Parameters:
name
- Name or description for the new application.callback
.updateApplication(appid, [options], callback)
Update the name and/or registration deletion permissions for an application.
Parameters:
appid
- The unique identifier for the application.options
- Object with optional parameters; see options below.callback
Options:
name
- Name or description for the application.allowdelete
- Sets whetherdeleteRegistration
can be used with this app.
.addSecretKey(appid, description, callback)
Create a new secret key for an application.
Parameters:
appid
- The unique identifier for the application.description
- Name or description for the new key.callback
.updateSecretKey(appid, keyid, [options], callback)
Updates a secret key associated with the given keyid.
Parameters:
appid
- The unique identifier for the application.keyid
- The unique identifier for the key. Key identifiers can be retrieved by callinggetAppInfo
.options
- Object with optional parameters; see options below.callback
Options:
description
- Name or description for the key.active
- Enables or disables the secret key for use.
.deleteSecretKey(appid, keyid, callback)
Deletes a secret key associated with the given keyid.
Parameters:
appid
- The unique identifier for the application.keyid
- The unique identifier for the key. Key identifiers can be retrieved by callinggetAppInfo
.callback
Tagging Service
.getCourseTags(courseid, callback)
Retrieve a list of tags for the specified course.
Parameters:
courseid
- The unique identifier for the course.callback
.setCourseTags(courseid, tags, callback)
Set a list of tags for the specified course.
Parameters:
courseid
- The unique identifier for the course.tags
- Comma separated list of tags to set for the course.callback
.addCourseTag(courseid, tag, callback)
Add a tag to the specified course.
Parameters:
courseid
- The unique identifier for the course.tag
- The tag to associate with the course.callback
.removeCourseTag(courseid, tag, callback)
Remove a tag from the specified course.
Parameters:
courseid
- The unique identifier for the course.tag
- The tag to remove from the course.callback
.getLearnerTags(learnerid, callback)
Retrieve a list of tags for the specified learner.
Parameters:
learnerid
- The unique identifier for the learner.callback
.setLearnerTags(learnerid, tags, callback)
Set a list of tags for the specified learner.
Parameters:
learnerid
- The unique identifier for the learner.tags
- Comma separated list of tags to set for the learner.callback
.addLearnerTag(learnerid, tag, callback)
Add a tag to the specified learner.
Parameters:
learnerid
- The unique identifier for the learner.tag
- The tag to associate with the learner.callback
.removeLearnerTag(learnerid, tag, callback)
Remove a tag from the specified learner.
Parameters:
learnerid
- The unique identifier for the learner.tag
- The tag to remove from the learner.callback
.getRegistrationTags(regid, callback)
Retrieve a list of tags for the specified registration.
Parameters:
regid
- The unique identifier for the registration.callback
.setRegistrationTags(regid, tags, callback)
Set a list of tags for the specified registration.
Parameters:
regid
- The unique identifier for the registration.tags
- Comma separated list of tags to set for the registration.callback
.addRegistrationTag(regid, tag, callback)
Add a tag to the specified registration.
Parameters:
regid
- The unique identifier for the registation.tag
- The tag to associate with the registration.callback
.removeRegistrationTag(regid, tag, callback)
Remove a tag from the specified registration.
Parameters:
regid
- The unique identifier for the registration.tag
- The tag to remove from the registration.callback
Reporting Service
.getAccountInfo(callback)
Retrieve information about the account associated with the appid
.