Submit a request
Submit a request

Getting Started With the Data API

This page contains a PHP example of how to setup security parameters for authentication. Learnosity supplies an SDK available in PHPJavaASP.NetPython, NodeJS, or Ruby. You can add one of these to your codebase and get going quickly by following the readme and examples in each SDK.

$security = array(
    'consumer_key' => 'INSERT_CONSUMER_KEY_HERE',
    'domain'       => ''

$consumer_secret = 'INSERT_CONSUMER_SECRET_HERE';

$request = array(
    'limit' => 50,
    'types' => array('unit', 'module')

$action = 'get';

Once you have prepared your security and request details, use them to make an API resource request. Be certain to target an appropriate Long Term Release version number in your request URL as shown in the example.

use LearnositySdk\Request\DataApi;

$dataApi = new DataApi();
    function ($data) {

Once we have the response, which is a JSON Object, we can do a number of things - persist this information to a backend DB, present it to a front-end webpage for rendering via JavaScript, or make use of the SDK to pass a callback for data processing.

function myCallback($data)
    // Do something with $data

Did you arrive here by accident? If so, learn more about Learnosity by clicking here.