A C# library to assist in the integration of the SCORM Cloud service into .Net 2.0+ applications.
Clone or download
rwiggins Merge pull request #51 from AndrewHore/master
Fix bug where CourseService.GetImportCourseAsyncUrl is always using ScormCloud.Configuration
Latest commit 7f4464e Sep 19, 2018
Permalink
Failed to load latest commit information.
Properties Prepare release 1.6.3 Sep 17, 2018
.gitignore adds nupkg to ignore May 11, 2017
AsyncImportResult.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
Configuration.cs Added origin string parameter to configuration and service requests. Aug 26, 2011
CourseData.cs Fix tag parsing in CourseData May 11, 2018
CourseDetail.cs Fix parsing of tags in getCourseDetail Xml response. Nov 20, 2017
CourseService.cs Update CourseService.GetImportCourseAsyncUrl to use the configuration… Sep 18, 2018
CourseVersion.cs Fix parsing of getCourseDetail Xml Nov 20, 2017
CustomWebClient.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
DebugService.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
DestinationData.cs Created methods for dispatch management in dispatch service. Oct 6, 2011
DispatchData.cs Clean up whitespace Sep 13, 2018
DispatchService.cs Clean up whitespace Sep 13, 2018
Enums.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
Export.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
ExportService.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
FileData.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
FtpService.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
ImportResult.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
InstanceData.cs Create InstanceData.cs Mar 14, 2013
InvitationInfo.cs adding Invitation Service support May 15, 2012
InvitationService.cs Fixed some broken casing. Request parameters are case sensitive Jun 20, 2012
LICENSE.md Rewrite README Nov 14, 2017
LaunchInfo.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
LrsAccountService.cs added lrsaccountservice May 5, 2014
Metadata.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
PostbackInfo.cs Add @musicm122's registration service changes Aug 5, 2015
README.md Prepare release 1.6.3 Sep 17, 2018
RegistrationData.cs Added additional support postbacks in the Registration Jul 25, 2015
RegistrationService.cs Fix handling of urlname/urlpass in testRegistrationPostUrl Jun 4, 2018
RegistrationSummary.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
ReportingService.cs Fixing bug with launching report. This depends on using the ScormClou… Sep 19, 2015
RequestSigner.cs Sort parameters case insensitively as (now) demanded by the API doc Jul 6, 2012
Rsp.cs Added additional support postbacks in the Registration Jul 25, 2015
RusticiSoftware.HostedEngine.Client.csproj adds rustici.course.getCourseDetail API Aug 1, 2017
RusticiSoftware.HostedEngine.Client.nuspec Prepare release 1.6.3 Sep 17, 2018
RusticiSoftware.HostedEngine.Client.sln convert master to NET 4.0 Aug 29, 2012
ScormCloud.cs Merge pull request #6 from cemerson/master Jun 11, 2014
ScormEngineService.cs Merge pull request #6 from cemerson/master Jun 11, 2014
ScormEngineUtilities.cs Added origin string parameter to configuration and service requests. Aug 26, 2011
ServiceException.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
ServiceRequest.cs Clean up whitespace Sep 13, 2018
TaggingService.cs Course Tag methods fix Jul 7, 2014
UploadResult.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
UploadService.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
UploadToken.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
UserInvitationStatus.cs adding Invitation Service support May 15, 2012
Utils.cs ParseNullableDate function Mar 14, 2013
XmlUtils.cs Normalized line endings and upgraded project to 2008. Aug 26, 2011
clienttests.cs 20140219 - TaggingService.cs / CreateRegistrationWithTags() Feb 19, 2014

README.md

SCORM Cloud C#.NET API Bindings

This library provides implementations for the majority, but not all, of the SCORM Cloud API. It is provided under the BSD 3-clause License (see LICENSE).

You can sign up for a SCORM Cloud account at https://cloud.scorm.com.

See our API quick start guide for more information.

Requirements

Requires .NET 2.0+

Installation

Via NuGet

This library is available via NuGet.

From the command line:

nuget install RusticiSoftware.HostedEngine.Client

From Package Manager:

Install-Package RusticiSoftware.HostedEngine.Client -Version 1.6.3

From .NET CLI:

dotnet add package RusticiSoftware.HostedEngine.Client --version 1.6.3

Configuration

Single App ID

If you're only using a single application (app ID), you can use the ScormCloud convenience singleton class:

ScormCloud.Configuration =
    new RusticiSoftware.HostedEngine.Client.Configuration(
        "https://cloud.scorm.com/EngineWebServices",
        "your app id",
        "your secret key",
        "your origin string");

where your app id is the app ID in question, your secret key is a secret key for that app ID, and your origin string is a company/app description. (The origin string is used for debugging on the SCORM Cloud developers' side.) See API quick start for information on app ID / secret keys.

Multiple App IDs

If you're using multiple applications in SCORM Cloud, you'll need to build the ScormEngineService class manually.

Configuration cfg =
    new RusticiSoftware.HostedEngine.Client.Configuration(
        "https://cloud.scorm.com/EngineWebServices",
        "your app id",
        "your secret key",
        "your origin string");

ScormEngineService service = new ScormEngineService(cfg);

This readme assumes the single app ID case, but the interface of ScormCloud and ScormEngineService are effectively the same. For example, instead of ScormCloud.CourseService, you'd use service.CourseService.

Example API Calls

Once installed and configured, it's time to make API calls. As explained in the quick start guide, the library implements the scaffolding used to interact with the actual web API.

We also have a .NET demo app built using this client library, which contains far more example code, but may not necessarily be following best practices.

Registration Exists

Corresponds to rustici.registration.exists.

bool exists = ScormCloud.RegistrationService.RegistrationExists("reg id");

Create Registration

Corresponds to rustici.registration.createRegistration.

ScormCloud.RegistrationService.CreateRegistration(
    "registration id",
    "course id",
    "learner id",
    "learner first name",
    "learner last name");

As explained in the LMS Integration Guide, the registration, course, and learner IDs are provided by your system. The course ID needs to be an ID for a course that's already been imported. See the LMS integration guide for more information about integrating a typical LMS with SCORM Cloud.

Building Launch Link

As explained in rustici.registration.launch, the launch API call is different from nearly every other API call in that it's intended for integrating systems to redirect learners to that API call URL instead of calling it server-side.

The client library facilitates this by providing a GetLaunchUrl method:

string launchUrl = ScormCloud.RegistrationService.GetLaunchUrl(
    "registration id",
    "redirect on exit url");

where registration id is the registration to launch and redirect on exit url is the URL to which the learner should be redirected if they exit the course. (Note: as discussed in the LMS Integration Guide, don't rely on learners hitting the redirect on exit URL.)

In a typical .NET web-app, you might redirect to this:

Response.Redirect(launchUrl);

The library provides other overrides for GetLaunchUrl that have more parameters.

Implementing Other API Calls

Although this library implements most of the SCORM Cloud API, it doesn't implement all of it. In cases where the library is insufficient, you can use the ServiceRequest class to directly call API methods described in the API reference:

ServiceRequest request = ScormCloud.CreateNewRequest();

request.Parameters.Add("regid", "your reg id");

XmlDocument response = request.CallService("rustici.registration.exists");
XmlElement attrEl = (XmlElement) response.GetElementsByTagName("result")[0];

bool exists = Convert.ToBoolean(attrEl.InnerXml.ToString());

This snippet of code manually builds a ServiceRequest with one parameter and then uses CallService to invoke the request for a particular API method.

As it happens, this is (close to) the implementation of the RegistrationExists method above.

If you find methods missing and would like to implement them, we would be eternally grateful for any pull requests.

Support

Need to get in touch with us? Contact us at support@scorm.com. Ask us anything.

Don't hesitate to submit technical questions. Our support staff are excellent, and even if they can't answer a question or resolve a problem, tickets get escalated quickly to real, live developers.