API Quick Start
This document contains information on Getting Started with the SCORM Cloud API.
The first step is to sign up for a SCORM Cloud account. As explained in concepts, this will create a single realm with two applications by default. The Trial billing plan is free, albeit with some restrictions:
- You may only have 10 active registrations at one time.
- You may only have 100 MB of course content.
While developing an integration with SCORM Cloud, we recommend deleting courses and registrations once you’re finished using them, so as to stay below the trial limits. Alternately, you can upgrade your account to a paid level. See SCORM Cloud Pricing for more information.
Once you’ve got a SCORM Cloud account, log into it and go to the Apps / API page. The API exposes and allows the management of information inside each of these applications.
Your API credentials are an Application ID (App ID) and a Secret Key. Click “Details” on one of your applications. The App ID for that application is at the top of the page. The secret keys are under Authorization Keys. Any of the secret keys will work for the API.
Take note of an app ID and secret key; we’ll use them later.
We provide API v1 client libraries for some common programming languages:
If you’re using one of these languages, we strongly recommend using these libraries as at least a starting point. If not, see advanced/communication for the communication format of the SCORM Cloud API. (We recommend using the client libraries as a reference when implementing your own client.)
The client libraries do not necessarily have every API call implemented, although we’ve tried to implement the most common, and we’re adding missing API calls as people report them. The Python library in particular needs improvement; it’s on our roadmap.
Fortunately, adding new API calls to the libraries is fairly straightforward.
Our API v2 is built with swagger. We have already generated clients for the API v2 in most of the popular languages. The API v2 is still in beta, so if you run into any bugs in the clients please let us know by contacting firstname.lastname@example.org.
It’s worth understanding that SCORM Cloud’s v1 API is based around simple HTTP GETs or POSTs, although it’s not RESTful. API calls end up looking like:
When working with our API v1 client libraries manually, building URLs by hand is not necessary; however, there are circumstances where it’s useful to understand that an API call is a GET or POST request to a particular URL.
Here’s where the rubber meets the road, so to speak. Each of the client libraries has its own README that explains how to configure the library and gives some sample API calls using that library. Below, we’ll look at some sample code using the Java client library.
We have demo applications for Java and .NET, which can be useful to reference, but it’s generally easier to try some simple code in your own development environment. Our PHP library also has a samples directory in it.
Each of our client libraries uses a
Configuration object to store the
API credentials and configuration. Here’s how the Java one works:
Configuration cfg = new Configuration( "https://cloud.scorm.com/EngineWebServices", "your app ID", "your secret key", "test.app.1.0");
Configuration has four parameters:
Service URL-- this is a relic of previous product iteration and should usually be set to the value above (unless you cannot support HTTPS for some reason).
App ID-- the application ID you noted above
Secret Key-- one of the secret keys you noted above
Origin String-- used for debugging on the SCORM Cloud developers’ side; it’s useful for this value to be your application or company name, but it doesn’t have to be.
With this, you can configure the
ScormCloud convenience singleton:
The ScormCloud class is a convenience class to provide access to a variety of pre-built methods. For example, to check if a course exists,
boolean exists = ScormCloud.getCourseService().Exists("some course id");
some course id would, of course, be some course ID. We recommend
looking at the README for a specific client library for more
information, or contact us at support.
Clients are Wrappers
The API client libraries are relatively thin wrappers around the real
web API. The above
.getCourseService().Exists corresponds to the
“real” course service’s exists
method. That is: the web documentation is authoritative, and so when
we link to API methods in the documentation, we’re linking to the
authoritative web API documentation. Client libraries (usually)
have matching methods already implemented.
The ScormCloud class just offers convenient access to already
implemented API calls. However, using the
ServiceRequest class, we can
directly make any API call in SCORM Cloud, even one that’s not
already implemented in the library itself. For example,
ServiceRequest request = new ServiceRequest(cfg); request.getParameters().add("courseid", "some course id"); Document response = request.callService("rustici.course.exists"); Element resultElem = (Element) (response.getElementsByTagName("result").item(0)); return Boolean.parseBoolean(resultElem.getTextContent());
This block of code calls the
rustici.course.exists method, the same as
the above, directly. This is actually the implementation of the
CourseService#Exists method in the Java client library.
The above Java examples are written in Java, but all of our client libraries implement effectively the same set of classes.