SCORM Cloud V1 API Overview
Web API
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:
https://cloud.scorm.com/api?method=rustici.registration.exists®id=123&appid=app123&ts=20171026221952&sig=.....
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.
Example Code
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.
Note
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");
This 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 aboveSecret Key
-- one of the secret keys you noted aboveOrigin 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:
ScormCloud.setConfiguration(cfg);
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");
where 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.
Conclusion
Now that you’ve got an API client up and going, take a look at LMS Integration or the API Reference. Have further questions? Contact our support.