Using the REST API

Overview

The REST API provides integration of CK-12 content for your web site. Simply make an HTTP request using the language of your choice, and parse the returned JSON for use in your application or website.

Example

This example uses JQuery to request data inside an HTML page. (Spacing and line breaks added for visual clarity.)

<!DOCTYPE HTML> 
<html> 
<head> 
<title>Parsing REST API</title> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> 

<script> 
  $(function() {    
    $.getJSON("http://www.ck12.org/flx/get/recommendations?
searchTerm=physics&
level=basic&
instanceID=520c42d05aa41321dfed7e8c&
modalityTypes=lesson", function(data, status) { var output = JSON.stringify(data, null, 2); document.getElementById("apiOutput").innerHTML = "<pre><code>" + output + "</code></pre>"; }); }); </script> </head> <body> <div id="apiOutput"></div> </body> </html>

Available Request Parameters 

Parameters

Explanation

Possible Values

sid

Standard ID Label.  This maps to specific CCSS and NGSS standards.

(Semi-optional - either sid or searchTerm must be specified)

Supported SID Labels

boardName

Standard Board Name for the corresponding sid. 

‘ccss’, ‘ngss’

Optionally, with a country prefix: ‘us.ccss’, ‘us.ngss’

searchTerm

Specify a subject by name or keywords. If multiple concepts are mapped to the given searchTerm then the best match is picked. If both sid and searchTerm is specified, then sid supersedes the searchTerm.

(Semi-optional - either sid or searchTerm must be specified)

 

level

Level of the modalities

(Optional)

‘basic’, ‘at grade’, ‘advanced’

modalityTypes

Comma separated list of CK-12 modality types to return

‘lesson’ (Read modality), ‘lecture’ (Videos), ‘enrichment’ (Videos), ‘rwa’ (Real World Application), ‘studyguide’ (Study Guide), ‘simulationint’ (Simulations), ‘plix’ (PLIXes), ‘asmtpractice’ (Practice)

instanceID

UniqueID to identify a practice attempt.

Send a unique string for instanceID.

 

Creating URLs (Needs a partner key)


Note
: Send the partner key as an HTTP header: x-ck12-meta-appid

URLs with minimal Chrome and CK-12 attribution should be created using this pattern:

Concept URL:

http://www.ck12.org/embed/#module=concept&handle=<conceptHandle>&branch=<branchHandle>&filters=text%2Cmultimedia%2Cstudy_resource%2Creal_world%2Cassessment&view_mode=embed&selectedFilter=text 

Modality URL:

http://www.ck12.org/embed/#module=modality&handle=<modalityHandle>&mtype=<modalityType>&context=<conceptHandle>&branch=<branchHandle>&filters=text%2Cmultimedia%2Cactivities%2Cstudy_resource%2Creal_world%2Cassessment&view_mode=embed

In the above patterns:

  • branchHandle: response.modalities[0].domain.branchInfo.handle
  • conceptHandle: modalities[i].domain.handle
  • modalityType: modalities[i].artifactType
  • modalityHandle: modalities[i].handle
  • filters: Are optional.
Have more questions? Submit a request
Powered by Zendesk