The Learndot API is organized around a REST model. The current implementation provides read and write access to Learndot entities allowing for cross domain resource sharing of Learndot's content in other web based applications.

Looking for the API reference documentation? Visit our demo site for a list of endpoints.

Getting Started

Getting started with the Learndot REST API is easy. First things first, take note of your Learndot base URL (the web address you use to access your Learndot site). We will refer to that address as YOUR_BASE_URL the rest of this guide.

Step 1 – Generate an API Token

API tokens are passed with every request as a header value for TRAININGROCKET-AUTHORIZATION. To Generate an API Key, navigate to the API menu under Setup in your Learndot administration. Alternatively, navigate directly to this URL in your browser.

YOUR_BASE_URL/admin/api/token


You'll need to have API ACCESS PERMISSION to be able to generate an API Key or use the REST API. For more information about Permissions see Contacts and Staff Roles & Permissions.

Step 2 – Review the API Documentation and Test it Out

So now you have an API Key, what can you do with it? We've got you covered! Learndot includes a dedicated API reference which also allows you test each of the operations available. To access it, navigate your browser to:

https://YOUR_BASE_URL/apidocs/index.html

You'll see the our Rest API Resources per the screenshot below.

  • Copy your API key into the text field at the top of the screen

  • Select List Operations
  • Choose an operation to test
  • Enter the required Parameters
  • Click Try it out!


Step 3 – Try a Code Snippet

The follow snippets demonstrate how to grab two contact entities with IDs 1 and 2.

Make sure to replace <API-KEY> and <BASE-URL> with the correct values.

When completing a request within a LDE Production or staging instance using AJAX it is advised to use a relative path url (Removing https://<BASE-URL>) to avoid issues with sharing cookies between HTTP/HTTPS cookies.

Curl
curl https://<BASE-URL>/api/rest/v1/manage/contact -X POST \
--header "Content-Type:application/json" --header "Accept:application/json" \
--header "TrainingRocket-Authorization:<API-KEY>" \
--data '{"id":["1","2"]}'
Python
from urllib.request import urlopen, Request
data = '{"id": ["1", "2"]}'.encode("UTF-8")
headers = {"TrainingRocket-Authorization": "<API-KEY>",
           "Content-Type": "application/json",
           "Accept": "application/json"}
req = Request("https://<BASE-URL>/api/rest/v1/manage/contact", data, headers, None, True, "POST")
resp = urlopen(req)
print(resp.read())
Java
package restclient;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
 
public class RESTClient {
    public static void main(String[] args) {
        HttpsURLConnection conn; 
        
        try {
             
            URL url = new URL("https://<BASE-URL>/api/rest/v1/manage/contact");
            conn = (HttpsURLConnection) url.openConnection();
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Accept", "application/json");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("TrainingRocket-Authorization", "<API-KEY>");
            conn.setDoOutput(true);
           
            OutputStream os = conn.getOutputStream();
            BufferedWriter writer = new BufferedWriter(
                        new OutputStreamWriter(os, "UTF-8"));
            writer.write("{\"id\": [\"1\", \"2\"]}");
            writer.close();
            os.close();
            
            if (conn.getResponseCode() != 200)
                throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
 
            BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
            String line; 
            while((line=br.readLine()) != null){
                System.out.println(line);
            }
            
            conn.disconnect();  
            
        } catch (Exception e) {
            e.printStackTrace();
        }  
    }
}

js - jQuery
 <!DOCTYPE html>
<html>
    <head>
		<script src="https://code.jquery.com/jquery-2.1.0.min.js" type="text/javascript"></script>
		<script type="text/javascript">
		$(document).ready(function() {
			$.ajax({
				
				type: "POST",
				url: "https://<BASE-URL>/api/rest/v1/manage/contact",
				contentType: "application/json; charset=utf-8",
		    	headers: {"TrainingRocket-Authorization": "<API-KEY>"}, 
		    	dataType: 'json',
		    	data: '{"id":["1","2"]}',
		    }).then(function(data) {
		 		console.log("got data  " )
		 		$('#response').append(JSON.stringify(data, undefined, 2));
		    
		    });
		    console.log("after ajax")
		}); 
		</script>
    </head>
<body>
	<div>Response : </div>
	<pre id="response"/>
</body>
</html> 

Supported HTTP Verbs

Our API currently supports the GET and POST HTTP verbs.

About Learndot REST API Authentication

API Keys sent in the request header over HTTPS are the only form of authentication supported by the Learndot Enterprise API. Note that REST calls go through the same authorization stack for entity access permissions. 

API keys are like passwords! They should be kept secret at all times.

Get to Know the Learndot Entities

How can you know what entities exist and what attributes they have? You'll need to know about entity keywords and describing entities.

List Entity Keywords

We've provided an endpoint to list all visible entity keywords for your API key. 

GET https://your-software-product.com

Again, this can be tested using our API reference page (see above).



Please find a list of entities listed below. Note that this list is an indication of entities and may change. For an up-to-date list please use the above method.

 Click for a List of Entities

A description of each of the below entities can be found in the documentation here: Entities

survey_response,
question_response,
product,
training_credit_account,
course_session,
forum_topic,
user_connection,
entity_notification,
survey_response_metric,
stream_post,
course_pathway_type,
training_credit_transaction,
affiliate_conversion,
public_course_event,
stream_post_comment,
location_feature,
virtual_machine_content,
credit_card_payment,
payment,
skill,
learning_pathway,
order,
content_access,
questionnaire_response,
course_pathway,
trigger,
affiliate,
affiliate_payment,
link_content,
text_question_response,
testimonial_response,
learning_component,
digital_content,
affiliate_customer_order_conversion,
training_credit_usage,
training_assessment_response,
order_discount,
social_connection,
text_question,
opportunity,
order_item,
forum_post,
content_option,
enrolment,
contact_file_attachment,
course_pathway_session,
content,
country_state,
course_requirement,
learning_resource,
provider,
learning_plan,
product_category,
learning_plan_item,
content_component,
label,
page,
course_category,
file_attachment,
blurb,
training_credit_redemption_request,
staff_role,
quiz_session,
training_opportunity,
multiple_choice_option,
watcher,
course,
talent_placement,
question,
learning_component_resource,
navigational_link,
system_setting,
knowledge_category_category,
training_survey_response,
agreement,
comment,
timesheet,
access_right,
course_event_resource,
multiple_choice_question_response,
request_for_contact,
content_session,
organization,
multiple_choice_question,
elearning_survey_response,
agreement_template,
knowledge_category,
training_credit_credit_transaction,
forum,
training_credit_debit_transaction,
e_learning_component,
quiz_component,
talent_opportunity,
course_testimonial,
forum_subscription,
content_option_resource,
course_event,
saml_config,
contact,
location,
training_credit_payment,
affiliate_visit,
private_course_event,
shipping_info,
event_extension,
discount_rule,
learning_pathway_session,
purchase_order_payment,
elearning_testimonial,
enrolment_resource,
saml_connection,
learning_pathway_requirement,
template,
forum_topic_subscription,
scheduled_report,
discount_use,
questionnaire,
affiliate_opportunity_conversion



Describe an Entity

The DESCRIBE endpoint can be used to determine the schema of an entity.

GET https://your-software-product.com/api/rest/v1/manage/contact/describe


System Settings

System SettingTypeDescriptionExample Value
api.enabledBooleanEnables/disables the REST API for your Learndot Enterprise site.true

Date and Timezone

The date format for all entities is as follows.

 "yyyy-MM-dd HH:mm:ss" 

To query a date field on an entity you will have to specify a date range. As an example, if you would like to query all Public Classes taught on March 2014, the data sent with the POST request would be as follows.

{
  "startTime": ["2014-03-01 00:00:00", "2014-03-31 23:59:59"]
}

For the use case above, you have to specify both date values to get the correct result set. Leaving a field empty would change the query to read as "all classes taught after" or "all classes taught before" depending on whether the end or start date has been left empty.


Looking for API reference documentation? Visit our demo site for a list of endpoints.