Frequently Used SCORM API Methods

SCORM Data Transfer Overview

If you are experiencing challenges with your SCORM-compliant course, then you may need to bring in an outside consultant. If that is the case, understanding some of the fundamental SCORM API methods may help you understand the information that your consultant shares with you. Click the “Ask the eLearning Experts” tab, input  your SCORM question/issue, and you will receive either an answer to your problem or a listing of SCORM consultants who specialize in exactly what you require.

 The SCORM specification has defined a minimum set of methods within the API that enable communication between the content that has been created (the SCO) and the target system from which the content will be accessed and tracked (the Learning Management System).

 The following methods are accessed by the SCO via JavaScript code with the syntax of:

objectname.methodname(argument(s)) – where…

  • objectname references the API
  • methodname is the method being used (see below)
  • argument(s) are the data passed to the method.

SCORM 2004 (1.3) API Methods:

Initialize – Initializes communication with the LMS. No other API methods should be called by the SCO until Initialize has been successfully called. returnValue = API_1484_11.Initialize(“”); When completed, the resulting returnValue will contain “true” if the method was successful, “false” if it was not.

GetValue – Retrieves data from the LMS for use in the SCO. The SCO must pass the data element that it is requesting as an argument. returnValue = API_1484_11.GetValue(“cmi.score.raw”); When completed, the resulting returnValue will contain the score that is retrieved from the LMS.

SetValue – Passes data from the SCO to the LMS. The data is retained and may be retrieved during the user session, but is not saved to the LMS until Commit is invoked. The SCO must indicate the data element and its value that is to be saved as arguments. returnValue = API_1484_11.SetValue(“cmi.score.raw”, “98”); When completed, the resulting returnValue will contain “true” if the method was successful, “false” if it was not.

Terminate – Terminates communication with the LMS. No other API methods should be called by the SCO afterTerminate has been successfully called. returnValue = API_1484_11.Terminate(“”); When completed, the resulting returnValue will contain “true” if the method was successful, “false” if it was not.

Commit – Saves the data that has been sent to the LMS via SetValue calls. If a SCO exits without invoking Commit, none of the learner’s data is saved to the LMS. Commit is implicitly invoked by the API when Terminate is called. returnValue = API_1484_11.Commit(“”); When completed, the resulting returnValue will contain “true” if the method was successful, “false” if it was not.

GetLastError – Retrieves the last numeric error code that occurred in the API as a result of invoking these methods. returnValue = API_1484_11.GetLastError(); When completed, the resulting returnValue will contain the code corresponding to the last error that occurred.

GetErrorString – Retrieves the text description corresponding to the error code provided. returnValue = API_1484_11.GetErrorString(errorCode); returnValue = API_1484_11.GetErrorString(122); When completed in either case, the resulting returnValue will contain a text description of the error corresponding to the error Code that was provided.

GetDiagnostic – Exists for LMS specific use. Returns a diagnostic text description based on the parameter that is passed as an argument. returnValue = API.GetDiagnostic(“diagnostic text”); When completed, the resulting returnValue will contain the text of the diagnostic information.

Shopping Cart
  • Your cart is empty.
Scroll to Top