NAV
xml json

Getting Started

The CollaborNation API is an HTTP-based RESTful API with token authorization. API request and response bodies can be formatted in either XML or JSON as specified by the client.

The CollaborNation API is flexible in its functionality and is capable of:

What you'll need before you start:

Contact a CypherWorx representative to provide these values.

API Tools

There are numerous tools available for developers to work with APIs. The CollaborNation API does not limit its usage and will work with most widely used API tools.

As a recommendation, we advise developers to try Postman due to its extensive capability.

API Requests

A simple request

GET https://collabornation.net/lms/api/0.08/user
GET https://collabornation.net/lms/api/0.08/user.json

Request with a body

PUT https://collabornation.net/lms/api/0.08/user/42

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <email>johnsmith@example.com</email>
  </user>
</request>
PUT https://collabornation.net/lms/api/0.08/user/42.json

{
  "user": {
    "id": "42",
    "firstname": "John",
    "lastname": "Smith",
    "email": "johnsmith@example.com"
  }
}

To construct a RESTful API request, combine these components:

Component Description
The HTTP Method
  • GET: Requests data from a resource.
  • POST: Submits data to a resource to process.
  • PUT: Updates a resource.
  • DELETE: Deletes a resource.
The URL to the API service https://collabornation.net/lms/api/X.XX where X.XX is your API version number
API Version The version of the API that your organization is consuming. The latest API version is 0.07.
The URI to the resource The resource to query, submit data to, update, or delete. For example, login/42.
A request body Required for many GET, POST, and PUT calls.

Example requests are displayed for XML and JSON.

API Versions

To ensure previous API connections remain undisrupted, the CollaborNation API may be updated with different versions to support more functionality. Please refer to the table for the differences between versions.

API Version Supported Functions
0.05 login, logout, course, report, record, grade, time, user, test, learn, my courses
0.06 login, logout, course, report, record, grade, time, user, test, learn, my courses, event
0.07 login, logout, course, report, record, grade, time, user, test, learn, my courses, event, reporting group, reporting group user

Output Formats

XML

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <foo xsi:nil="true"/>
</response>

XML (Extensible Markup Language) is the default output format for the CollaborNation API. The entire document must be contained within a single root element. The CollaborNation® API uses <response> as the root element to contain whatever is to be returned when responding to a request.

NULL values cannot be represented in XML; <foo></foo> and <foo/> both represent the same value, the empty string. Because of this, we use the XML Schema instance namespace which defines, among other things, a nil (NULL) attribute.

JSON

{
  "user": {
    "15": {"firstname":"John" /* ... */},
    "26": {"firstname":"Jacob" /* ... */}
  }
}

JSON is supported in the CollaborNation API. The output can be formatted for JSON by doing one of the following:

Please note, you must remove any / that appears at the end of a request URL before appending the .json. If both are specified and conflicting, the file extension takes precedence over the HTTP header.

Elements in arrays and objects are uniquely identified by their keys, meaning that sibling elements cannot share the same key. Because of this, any object with multiple instances of one type of field will have that field as an object with numeric keys.

API Admin Settings

Once CypherWorx sets up your organization with API access, a CypherWorx employee will then set individual accounts to have API Admin Settings access. This is a role separate from a site admin that grants the account the ability to make API calls and to view the API Admin Settings page. This page can be found under Admin Tools.

API Admin Settings block

API Credentials

At the top of the API Admin Settings page is:

This is the username, password, and URL used in your application to connect to the CollaborNation API services.

API Admin Credentials

Courses

To access courses via the API, organizations must register the courses via the API dashboard. This gives organizations the ability to assign a unique ID which links the CollaborNation course with your organization's system.

To register a course for the API, go to the API Admin Settings page, then click on Register a course with this API client.

Adding a course for the API requires two fields.

Adding an API course

The registered courses will then appear in the Courses table. There are a few fields:

API course listing

Users

User accounts can be created in a variety of ways, including letting individuals self-register into the site, having admins create accounts manually, or creating accounts through the API. If an account is created through the API, it gives developers access to features such as single sign-on.

Once an account is created with the API, they will appear on the Users page. This page displays the following details:

Image of API Users

It's also possible to add API users through the website by clicking on Register a user with this API client.

Adding an API User

Access Log

API calls made to CollaborNation are viewable in the Access Log section. This can be helpful for troubleshooting if the endpoints are being sent and received successfully, and if there are any error messages. The log is retained for the last 30 days.

Log of API calls

User

The User endpoint pertains to managing the users in your site. This section outlines how to create, retrieve, and update users.

Endpoint Logistics

Element Data Type Description
id integer The user ID.
firstname string The first name of the user.
lastname string The last name of the user.
login integer The unix timestamp of the last login to the LMS. 0 if the user has never logged in. Available in API version 0.07 onward.
membership_date integer The unix timestamp of the date the learner was registered into the site LMS. Available in API version 0.07 onward.
email string The email address of the user. This must be a unique, valid email address. If an email is not available, please use the domain @example.com as it's a reserved domain.
extra_registration string An organization may add any number of extra fields that a user may input data about themselves upon registration. Only values that have been set will be returned for a user. Learn more.

Create a user

Request

PUT https://collabornation.net/lms/api/0.08/user/42

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <email>johnsmith@example.com</email>
  </user>
</request>
PUT https://collabornation.net/lms/api/0.08/user/42.json

{
  "user": {
    "id": "42",
    "firstname": "John",
    "lastname": "Smith",
    "email": "johnsmith@example.com"
  }
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <email>johnsmith@example.com</email>
  </user>
</response>
{
  "user": {
    "id": "42",
    "firstname": "John",
    "lastname": "Smith",
    "email": "johnsmith@example.com"
  }
}

This endpoint creates a user in CollaborNation.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/user/<User ID>

URL Parameters

Parameter Description
User ID The ID of the user from the organization's system.

Create a user with additional registration fields

Request

PUT https://collabornation.net/lms/api/0.08/user/42

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <email>johnsmith@example.com</email>
    <extra_registration>
      <state>New York</state>
      <Department_Name>Programming</Department_Name>
      <position>Administration</position>
      <position>Counselor</position>
    </extra_registration>
  </user>
</request>
PUT https://collabornation.net/lms/api/0.08/user/42.json

{
  "user": {
    "id": "42",
    "firstname": "John",
    "lastname": "Smith",
    "email": "johnsmith@example.com",
    "extra_registration": {
      "state": "New York",
      "Department Name": "Programmer",
      "position": [
        "Administration",
        "Counselor"
      ]
    }
  }
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <email>johnsmith@example.com</email>
    <extra_registration>
      <state>New York</state>
      <Department_Name>Programming</Department_Name>
      <position>Administration</position>
      <position>Counselor</position>
    </extra_registration>
  </user>
</response>
{
  "user": {
    "id": "42",
    "firstname": "John",
    "lastname": "Smith",
    "email": "johnsmith@example.com",
    "extra_registration": {
      "state": "New York",
      "Department Name": "Programmer",
      "position": [
        "Administration",
        "Counselor"
      ]
    }
  }
}

CollaborNation offers the ability to set up your site to collect additional information about users at the time of registration. For more details please read our support hub article on Registration Fields.

This endpoint creates a user with additional registration fields.

If your Registration Field has a space and you are using XML, replace the spaces with underscores (_). This does not apply to JSON.

If your sending data for a Multi-Group registration field, please use the following format:

Please see the examples to the side to follow the proper format.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/user/<User ID>

URL Parameters

Parameter Description
User ID The ID of the user from the organization's system.

Retrieve all users

Request

GET https://collabornation.net/lms/api/0.08/user
GET https://collabornation.net/lms/api/0.08/user.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <email>johnsmith@example.com</email>
    <extra_registration>
      <state>New York</state>
    </extra_registration>
  </user>
  <user>
    <id>321</id>
    <firstname>Jane</firstname>
    <lastname>Doe</lastname>
    <email>janedoe@example.com</email>
    <extra_registration/>
  </user>
</response>
{
  "user": {
    "42": {
      "id": "42",
      "firstname": "John",
      "lastname": "Smith",
      "email": "johnsmith@example.com",
      "extra_registration": {
        "state": "New York",
      }
    },
    "321": {
      "id": "321",
      "firstname": "Jane",
      "lastname": "Doe",
      "email": "janedoe@example.com",
      "extra_registration": []
    }
  }
}

This endpoint returns all users in your organization’s site.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/user

URL Parameters

There are no URL parameters.

Query Parameters

Parameter Data Type Data Format Description
membership_start integer timestamp Retrieve users whose registration was at or after this time.
membership_end integer timestamp Retrieve users whose registration was at or before this time.
login_start integer timestamp Retrieve users whose last_login was at or before this time.
login_end integer timestamp Retrieve users whose last_login was at or after this time.
status integer -2, -1, 0, 1 Status of the user. -2 is Guest, -1 is Pending Approval, 0 is Inactive, 1 is Active.

Retrieve a user

Request

GET https://collabornation.net/lms/api/0.08/user/42
GET https://collabornation.net/lms/api/0.08/user/42.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <email>johnsmith@example.com</email>
    <extra_registration/>
  </user>
</response>
{
  "user": {
    "42": {
      "id": "42",
      "firstname": "John",
      "lastname": "Smith",
      "email": "johnsmith@example.com",
      "extra_registration": {
        "state": "New York"
      }
    }
  }
}

This endpoint returns the details of a single user.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/user/<User ID>

URL Parameters

Parameter Description
User ID The ID of the user.

Retrieve a user's ID by email

Request

POST https://collabornation.net/lms/api/0.08/email

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <email>johnsmith@example.com</email>
</request>
POST https://collabornation.net/lms/api/0.08/email.json

{
  "email": "johnsmith@example.com"
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <id>42</id>
</response>

// If there are multiple IDs.
<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <id>42</id>
  <id>111</id>
  <id>222</id>
</response>
{
  "id": [
    "42"
  ]
}

// If there are multiple IDs.
{
  "id": [
    "42",
    "111",
    "222"
  ]
}

Retrieve a user's ID by providing their email address.

If the user does not exist in the site, or if they do not have an ID assigned to them, you will receive the error message User Not Found.

If a user is assigned multiple IDs, every ID will appear.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/email

URL Parameters

There are no URL parameters.

Update a user

Request

PUT https://collabornation.net/lms/api/0.08/user/42

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smithers</lastname>
    <email>johnsmithers@example.com</email>
    <extra_registration/>
  </user>
</request>
PUT https://collabornation.net/lms/api/0.08/user/42.json

{
  "user": {
    "id": "42",
    "firstname": "John",
    "lastname": "Smithers",
    "email": "johnsmithers@example.com",
    "extra_registration": []
  }
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smithers</lastname>
    <email>johnsmithers@example.com</email>
    <extra_registration/>
  </user>
</response>
{
  "user": {
    "42": {
      "id": "42",
      "firstname": "John",
      "lastname": "Smithers",
      "email": "johnsmithers@example.com",
      "extra_registration": []
    }
  }
}

This endpoint allows the client to update details of an individual user.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/user/<User ID>

URL Parameters

Parameter Description
User ID The ID of the user.

Deactivate a user

Request

DELETE https://collabornation.net/lms/api/0.08/user/42

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smithers</lastname>
    <email>johnsmithers@example.com</email>
    <extra_registration/>
  </user>
</request>
DELETE https://collabornation.net/lms/api/0.08/user/42.json

{
  "user": {
    "id": "42",
    "firstname": "John",
    "lastname": "Smithers",
    "email": "johnsmithers@example.com",
    "extra_registration": []
  }
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smithers</lastname>
    <email>johnsmithers@example.com</email>
    <extra_registration/>
  </user>
</response>
{
  "user": {
    "42": {
      "id": "42",
      "firstname": "John",
      "lastname": "Smithers",
      "email": "johnsmithers@example.com",
      "extra_registration": []
    }
  }
}

This endpoint allows the client to deactivate an individual user. Deactivated accounts will be unable to log in and take training. Deactivated accounts will still exist in the system and their transcript can still be viewed by administrators.

HTTP Request

DELETE https://collabornation.net/lms/api/<X.XX>/user/<User ID>

URL Parameters

Parameter Description
User ID The ID of the user.

Log In and Redirect

The CollaborNation API gives developers single sign-on capability. To do so, you will want to:

CollaborNation also has other single sign-on capabilities, such as through SAML 2.0. Please refer to our Integrations section for more details.

Endpoint Logistics

Element Data Type Description
token string A 64-character hexadecimal string that uniquely identifies a user session. This token needs to be included as GET or POST data in any link the end user uses to access the LMS (the learn and my-courses endpoints). This token should be considered private, as the first user to use it will be logged into the corresponding user account on CollaborNation. Because of this, POST is preferred, so the end user doesn’t see the token unless manually inspecting the request.

Login

Request

GET https://collabornation.net/lms/api/0.08/login/42
GET https://collabornation.net/lms/api/0.08/login/42.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <token>8048567E08A6CBF38CF0AD0A7989D5FD92761CEFEB0F15516D284C4025A843BD</token>
</response>
{
  "token": "8048567E08A6CBF38CF0AD0A7989D5FD92761CEFEB0F15516D284C4025A843BD"
}

This section outlines a recommended approach for how to consume the CollaborNation SSO API endpoints.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/login/<User ID>

URL Parameters

Parameter Description
User ID The user ID of the individual to acquire the session token.

Logout

Request

PUT https://collabornation.net/lms/api/0.08/logout/42
# PUT https://collabornation.net/lms/api/0.08/logout/42.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <status>John Smith logged out successfully.</status>
</response>
{
  "status": "John Smith logged out successfully."
}

This section outlines how to log a user out of their account.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/logout/<User ID>

URL Parameters

Parameter Description
User ID The user ID of the individual to log out.

Learn

Request

PUT https://collabornation.net/lms/api/0.08/learn

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <token>8048567E08A6CBF38CF0AD0A7989D5FD92761CEFEB0F15516D284C4025A843BD</token>
</request>
# PUT https://collabornation.net/lms/api/0.08/learn.json

{
  "token": "8048567E08A6CBF38CF0AD0A7989D5FD92761CEFEB0F15516D284C4025A843BD"
}

Response

HTML for the learn page.

Log the user into CollaborNation®, and direct the user to the course player.

This link is accessed directly by the end user, and it must be accompanied by a user session token in the GET, PUT, or POST data.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/learn

URL Parameters

Parameter Description
Course Session ID The session ID of the user's course.

My Courses

Request

PUT https://collabornation.net/lms/api/0.08/my-courses

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <token>8048567E08A6CBF38CF0AD0A7989D5FD92761CEFEB0F15516D284C4025A843BD</token>
</request>
# PUT https://collabornation.net/lms/api/0.08/my-courses.json

Response

HTML for the My Courses page.

This endpoint logs the user into CollaborNation, then directs them to the My Courses page.

This link is accessed directly by the end user, and it must be accompanied by a user session token in the GET, PUT, or POST data.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/my-courses

URL Parameters

There are no URL parameters.

Course

This endpoint will allow you interact with the course content to facilitate these following activities; to discover the courses available for the site, discover all of the courses a user has in their account, or allow for a new course to be given to a user.

Endpoint Logistics

Element Data Type Description
course course A course object.
id integer The course ID.
title string The course title.
score integer The score earned by the user in the course, if a quiz is present.
masteryscore integer The minimum score required to pass a test, if the course has a scoring element. If the course does not have one, this value will be NULL. Empty string "" can also be used to denote a lack of masteryscore.
link string The URL which can be accessed by the user to reach this course session. This link will need a user session token passed along as a GET or POST value (with the key token).
course_link string The same as link.
expiration integer The timestamp for when this course session will expire. If the course does not expire, this value should be NULL. 0 (zero) and "" (empty string) can also be used to denote a lack of expiration.

Assign a course to a user

Request

PUT https://collabornation.net/lms/api/0.08/course/42/128
PUT https://collabornation.net/lms/api/0.08/course/42/128.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <session>
    <course>
      <id>128</id>
      <title>Sexual Harassment Prevention</title>
      <score xsi:nil="true"/>
      <expiration xsi:nil="true"/>
    </course>
    <link>https://collabornation.net/lms/api/0.08/learn/8681</link>
    <course_link>https://collabornation.net/lms/api/0.08/learn/8681</course_link>
    <expiration xsi:nil="true"/>
  </session>
</response>
{
  "session": {
    "2699538": {
      "course": {
        "id": "128",
        "title": "Sexual Harassment Prevention for Employees",
        "score": "",
        "expiration": null
      },
      "course_link": "https://collabornation.net/lms/api/0.08/learn/2699538",
      "link": "https://collabornation.net/lms/api/0.08/learn/2699538",
      "expiration": null
    }
  }
}

This endpoint assigns a course to a user.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/course/<User ID>/<Course ID>

URL Parameters

Parameter Description
User ID The user ID of the individual.
Course ID The ID of the course.

Get all courses for a given user

Request

GET https://collabornation.net/lms/api/0.08/course/42
GET https://collabornation.net/lms/api/0.08/course/42.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <session>
    <course>
      <id>128</id>
      <title>Sexual Harassment Prevention for Employees</title>
      <score xsi:nil="true"/>
      <expiration xsi:nil="true"/>
    </course>
    <link>https://collabornation.net/lms/api/0.08/learn/2699538</link>
    <course_link>https://collabornation.net/lms/api/0.08/learn/2699538</course_link>
    <expiration xsi:nil="true"/>
  </session>
  <session>
    <course>
      <id>129</id>
      <title>Another Course Title</title>
      <score xsi:nil="true"/>
      <expiration xsi:nil="true"/>
    </course>
    <link>https://collabornation.net/lms/api/X.XX/learn/8682</link>
    <course_link>https://collabornation.net/lms/api/X.XX/learn/8682</course_link>
    <expiration xsi:nil="true"/>
  </session>
</response>
{
  "session": {
    "2699538": {
      "course": {
        "id": "128",
        "title": "Sexual Harassment Prevention for Employees",
        "score": "",
        "expiration": null
      },
      "course_link": "https://collabornation.net/lms/api/0.08/learn/2699538",
      "link": "https://collabornation.net/lms/api/0.08/learn/2699538",
      "expiration": null
    }
  },
  "session": {
    "2699539": {
      "course": {
        "id": "129",
        "title": "Another Course Title",
        "score": "",
        "expiration": null
      },
      "course_link": "https://collabornation.net/lms/api/0.08/learn/8682",
      "link": "https://collabornation.net/lms/api/0.08/learn/8682",
      "expiration": null
    }
  }
}

This endpoint returns all courses that a user has in their account.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/course/<User ID>

URL Parameters

Parameter Description
User ID The ID of the user.

Get all courses

Request

GET https://collabornation.net/lms/api/0.08/course
GET https://collabornation.net/lms/api/0.08/course.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <course>
    <id>128</id>
    <title>Sexual Harassment Prevention for Employees</title>
    <score xsi:nil="true"/>
    <expiration xsi:nil="true"/>
  </course>
  <course>
    <id>129</id>
    <title>Another Course Title</title>
    <score xsi:nil="true"/>
    <expiration xsi:nil="true"/>
  </course>
  <course>
    <id>130</id>
    <title>Lorem Ipsum</title>
    <score>70</score>
    <expiration xsi:nil="true"/>
  </course>
</response>
{
  "course": [
    {
      "id": "128",
      "title": "Sexual Harassment Prevention for Employees",
      "score": "",
      "expiration": null
    }
    {
      "id": "129",
      "title": "Another Course Title",
      "score": "",
      "expiration": null
    },
    {
      "id": "130",
      "title": "Lorem Ipsum",
      "score": "70",
      "expiration": null
    }
  ]
}

This endpoint returns all courses in your organization’s site.

HTTP Request

GET https://collabornation.net/lms/api/X.XX/course/

URL Parameters

There are no URL parameters.

Get a course for a user

Request

GET https://collabornation.net/lms/api/0.08/course/42/128
GET https://collabornation.net/lms/api/0.08/course/42/128.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <session>
    <course>
      <id>128</id>
      <title>Sexual Harassment Prevention for Employees</title>
      <score xsi:nil="true"/>
      <expiration xsi:nil="true"/>
    </course>
    <link>https://collabornation.net/lms/api/X.XX/learn/251</link>
    <course_link>https://collabornation.net/lms/api/X.XX/learn/251</course_link>
    <expiration xsi:nil="true"/>
  </session>
</response>
{
  "session": {
    "2699538": {
      "course": {
        "id": "128",
        "title": "Sexual Harassment Prevention for Employees",
        "score": "",
        "expiration": null
      },
      "course_link": "https://collabornation.net/lms/api/0.08/learn/2699538",
      "link": "https://collabornation.net/lms/api/0.08/learn/2699538",
      "expiration": null
    }
  }
}

This endpoint returns the details of a course for a user.

HTTP Request

GET https://collabornation.net/lms/api/X.XX/course/<User ID>/<Course ID>

URL Parameters

Parameter Description
User ID The ID of the user.
Course ID The ID of the course.

Grade

Grade all users

Request

GET https://collabornation.net/lms/api/0.08/grade
GET https://collabornation.net/lms/api/0.08/grade.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <report>
      <course>
        <id>87978</id>
      </course>
      <status>not attempted</status>
      <score xsi:nil="true"/>
      <finish_date xsi:nil="true"/>
      <time>0000:00:00</time>
      <course_link>https://collabornation.net/lms/api/0.08/learn/245363</course_link>
      <link>https://collabornation.net/lms/api/0.08/learn/245363</link>
    </report>
    <id>545</id>
  </user>
  <user>
      <report>
          <course>
            <id>128</id>
          </course>
          <status>not attempted</status>
          <score xsi:nil="true"/>
          <finish_date xsi:nil="true"/>
          <time>0000:00:00</time>
          <course_link>https://collabornation.net/lms/api/0.08/learn/2699538</course_link>
          <link>https://collabornation.net/lms/api/0.08/learn/2699538</link>
      </report>
      <id>42</id>
  </user>
</response>
{
  "user": {
    "42": {
      "report": {
        "2699538": {
          "course": {
            "id": "128"
          },
          "status": "not attempted",
          "score": null,
          "finish_date": null,
          "time": "0000:00:00",
          "course_link": "https://collabornation.net/lms/api/0.08/learn/2699538",
          "link": "https://collabornation.net/lms/api/0.08/learn/2699538"
        }
      },
      "id": 42
    },
    "545": {
      "report": {
        "245363": {
          "course": {
            "id": "87978"
          },
          "status": "not attempted",
          "score": null,
          "finish_date": null,
          "time": "0000:00:00",
          "course_link": "https://collabornation.net/lms/api/0.08/learn/245363",
          "link": "https://collabornation.net/lms/api/0.08/learn/245363"
        }
      },
      "id": 545
    }
  }
}

The grade endpoint returns a simplified user object for every user registered in the API. Each user object will contain a simplified report object for each course session they have, only for courses registered within the API.

The simplified user object removes firstname, lastname, and email. It does not remove the course ID.

HTTP Request

https://collabornation.net/lms/api/<X.XX>/grade

URL Parameters

There are no URL parameters.

Event

The event endpoints allow you to interact with the Events section of the CollaborNation LMS. Events are often used for live training courses. Common event endpoints include viewing all events available in your site and registering a user into an event.

Endpoint Logistics

Element Data Type Description
id integer The event ID.
title string The name of the event.
description string The description of the event.
location string The location of an event.
start string The start date and time for an event, in ISO-8601 format.
end string The end date and time for an event, in ISO-8601 format.
score integer The minimum score required to pass a test, if the event has a scoring element. If the event does not have one, this value will be NULL. Empty string "" can also be used to denote a lack of a score.
public string Is the event open to the public? Options are yes or no.
certificate string Is a certificate awarded upon completion? Options are yes or no.
attending_count integer The number of users set to attend the event. This number includes users that may not be registered in the API but exists in the site.
attendees user An array of users who are attending the event.
registered_seats user An array of users who are registered for the event.
seats integer/string The number of total seats available for a seating event, or unlimited if the event has no limit.
taken_count integer/string The number of seats filled for a limited seating event, or none if the event has no seating limit. This number includes users that may not be registered in the API but exists in the site.
category string The category for the event. Options are instructor-led classroom, instructor-led online, non-training, and none.

Retrieve all events

Request

GET https://collabornation.net/lms/api/0.08/event
GET https://collabornation.net/lms/api/0.08/event.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <event>
    <id>16</id>
    <title>Public Event</title>
    <description>An event open to everyone.</description>
    <location>Rochester, New York</location>
    <start>2015-08-20T17:30:00-04:00</start>
    <end>2015-08-20T19:30:00-04:00</end>
    <score xsi:nil="true"/>
    <public>yes</public>
    <certificate>no</certificate>
    <attending_count>0</attending_count>
    <attendees/>
    <registered_seats/>
    <seats>unlimited</seats>
    <taken_count>none</taken_count>
    <category>none</category>
</event>
<event>
  <id>20</id>
  <title>Open registration, private</title>
  <description>A limited seating, private event.</description>
  <location>Rochester, New York</location>
  <start>2015-08-29T12:30:00-04:00</start>
  <end>2015-08-29T13:30:00-04:00</end>
  <score xsi:nil="true"/>
  <public>no</public>
  <certificate>no</certificate>
  <attending_count>2</attending_count>
  <attendees>
    <user>
      <id>42</id>
      <firstname>John</firstname>
      <lastname>Smith</lastname>
      <email>johnsmith@example.com</email>
      <extra_registration/>
    </user>
    <user>
      <id>321</id>
      <firstname>Jane</firstname>
      <lastname>Doe</lastname>
      <email>janedoe@example.com</email>
      <extra_registration>
        <state>New York</state>
      </extra_registration>
    </user>
  </attendees>
  <registered_seats>
    <user>
      <id>42</id>
      <firstname>John</firstname>
      <lastname>Smith</lastname>
      <email>johnsmith@example.com</email>
      <extra_registration/>
    </user>
    <user>
      <id>321</id>
      <firstname>Jane</firstname>
      <lastname>Doe</lastname>
      <email>janedoe@example.com</email>
      <extra_registration>
        <state>New York</state>
      </extra_registration>
    </user>
  </registered_seats>
  <seats>3</seats>
  <taken_count>2</taken_count>
  <category>none</category>
  </event>
</response>
{
  "event": [
    {
      "id": "16",
      "title": "Public Event",
      "description": "An event open to everyone.",
      "location": "Rochester, New York",
      "start": "2015-08-20T17:30:00-04:00",
      "end": "2015-08-20T19:30:00-04:00",
      "score": null,
      "public": "yes",
      "certificate": "no",
      "attending_count": "0",
      "attendees": [],
      "registered_seats": [],
      "seats": "unlimited",
      "taken_count": "none",
      "category": "none"
    },
    {
      "id": "20",
      "title": "Open registration, private",
      "description": "A limited seating, private event.",
      "location": "Rochester, New York",
      "start": "2018-12-28T12:30:00-05:00",
      "end": "2018-12-28T13:30:00-05:00",
      "score": null,
      "public": "no",
      "certificate": "no",
      "attending_count": "2",
      "attendees": {
        "user": {
          "321": {
            "id": "321",
            "firstname": "Jane",
            "lastname": "Doe",
            "email": "janedoe@example.com",
            "extra_registration": {
              "state": "New York"
            }
          },
          "426": {
            "id": "426",
            "firstname": "John",
            "lastname": "Smith",
            "email": "johnsmith@example.com",
            "extra_registration": {
              "state": "NY"
            }
          }
        }
      },
      "registered_seats": {
        "user": {
          "321": {
            "id": "321",
            "firstname": "Jane",
            "lastname": "Doe",
            "email": "janedoe@example.com",
            "extra_registration": {
              "state": "New York"
            }
          },
          "426": {
            "id": "426",
            "firstname": "John",
            "lastname": "Smith",
            "email": "johnsmith@example.com",
            "extra_registration": {
              "state": "NY"
            }
          }
        }
      },
      "seats": "3",
      "taken_count": "2",
      "category": "non-training"
    },

This endpoint returns all events in an organization.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/event

URL Parameters

There are no URL parameters.

Query Parameters

Parameter Data Type Data Format Description
start string YYYY-mm-dd Retrieve events based on the start date.
end string YYYY-mm-dd Retrieve events based on the end date.
location string YYYY-mm-dd Retrieve events based on location. Partial matching is allowed.
certificate integer 0 or 1 Retrieve events based on the certificate status.
public integer 0 or 1 Retrieve events based on the public/private status.

Retrieve an event

Request

GET https://collabornation.net/lms/api/0.08/event/20
GET https://collabornation.net/lms/api/0.08/event/20.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <event>
    <id>20</id>
    <title>Open reg, private</title>
    <description>A limited seating, private event.</description>
    <location>Rochester, New York</location>
    <start>2015-08-29T12:30:00-04:00</start>
    <end>2015-08-29T13:30:00-04:00</end>
    <score xsi:nil="true"/>
    <public>no</public>
    <certificate>no</certificate>
    <attending_count>2</attending_count>
    <attendees>
      <user>
        <id>42</id>
        <firstname>John</firstname>
        <lastname>Smith</lastname>
        <email>johnsmith@example.com</email>
        <extra_registration/>
      </user>
      <user>
        <id>321</id>
        <firstname>Jane</firstname>
        <lastname>Doe</lastname>
        <email>janedoe@example.com</email>
        <extra_registration>
          <state>New York</state>
        </extra_registration>
      </user>
    </attendees>
    <registered_seats>
    <user>
      <id>42</id>
      <firstname>John</firstname>
      <lastname>Smith</lastname>
      <email>johnsmith@example.com</email>
      <extra_registration/>
    </user>
    <user>
      <id>321</id>
      <firstname>Jane</firstname>
      <lastname>Doe</lastname>
      <email>janedoe@example.com</email>
      <extra_registration>
        <state>New York</state>
      </extra_registration>
    </user>
    </registered_seats>
    <seats>3</seats>
    <taken_count>2</taken_count>
    <category>none</category>
  </event>
</response>
{
  "event": [
    {
      "id": "2",
      "title": "Open registration, private",
      "description": "A limited seating, private event.",
      "location": "Rochester, New York",
      "start": "2015-08-29T12:30:00-04:00",
      "end": "2015-08-29T13:30:00-04:00",
      "score": null,
      "public": "no",
      "certificate": "no",
      "attending_count": "2",
      "attendees": {
        "user": {
          "321": {
            "id": "321",
            "firstname": "Jane",
            "lastname": "Doe",
            "email": "janedoe@example.com",
            "extra_registration": {
              "state": "New York"
            }
          },
          "426": {
            "id": "426",
            "firstname": "John",
            "lastname": "Smith",
            "email": "johnsmith@example.com",
            "extra_registration": {
              "state": "NY"
            }
          }
        }
      },
      "registered_seats": {
        "user": {
          "321": {
            "id": "321",
            "firstname": "Jane",
            "lastname": "Doe",
            "email": "janedoe@example.com",
            "extra_registration": {
              "state": "New York"
            }
          },
          "426": {
            "id": "426",
            "firstname": "John",
            "lastname": "Smith",
            "email": "johnsmith@example.com",
            "extra_registration": {
              "state": "NY"
            }
          }
        }
      },
      "seats": "3",
      "taken_count": "2",
      "category": "non-training"
    }
  ]
}

This endpoint returns the details of one event.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/event/<Event ID>

URL Parameters

Parameter Description
Event ID The ID of the event you would like to retrieve details of.

Query Parameters

Parameter Data Type Data Format Description
start string YYYY-mm-dd Retrieve event based on the start date.
end string YYYY-mm-dd Retrieve event based on the end date.
location string YYYY-mm-dd Retrieve event based on location. Partial matching is allowed.
certificate integer 0 or 1 Retrieve event based on the certificate status.
public integer 0 or 1 Retrieve event based on the public/private status.

Register a user for an event

Request

PUT https://collabornation.net/lms/api/0.08/event/20/42
PUT https://collabornation.net/lms/api/0.08/event/20/42.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <event>
    <id>20</id>
    <title>Open reg, private</title>
    <description>A limited seating, private event.</description>
    <location>Rochester, New York</location>
    <start>2015-08-29T12:30:00-04:00</start>
    <end>2015-08-29T13:30:00-04:00</end>
    <score xsi:nil="true"/>
    <public>no</public>
    <certificate>no</certificate>
    <attending_count>2</attending_count>
    <attendees>
      <user>
        <id>789</id>
        <firstname>User</firstname>
        <lastname>Test</lastname>
        <email>test_cn_42@example.com</email>
        <extra_registration/>
      </user>
      <user>
        <id>42</id>
        <firstname>John</firstname>
        <lastname>Doe</lastname>
        <email>johndoe@example.com</email>
        <extra_registration/>
      </user>
      <user>
        <id>321</id>
        <firstname>Jane</firstname>
        <lastname>Doe</lastname>
        <email>janedoe@example.com</email>
        <extra_registration>
          <state>New York</state>
        </extra_registration>
      </user>
    </attendees>
    <registered_seats>
    <user>
      <id>789</id>
      <firstname>User</firstname>
      <lastname>Test</lastname>
      <email>test_cn_42@example.com</email>
      <extra_registration/>
    </user>
    <user>
      <id>42</id>
      <firstname>John</firstname>
      <lastname>Doe</lastname>
      <email>johndoe@example.com</email>
      <extra_registration/>
      </user>
      <user>
        <id>321</id>
        <firstname>Jane</firstname>
        <lastname>Doe</lastname>
        <email>janedoe@example.com</email>
        <extra_registration>
          <state>New York</state>
        </extra_registration>
      </user>
    </registered_seats>
    <seats>3</seats>
    <taken_count>3</taken_count>
    <category>none</category>
  </event>
</response>
{
  "event": [
    {
      "id": "2",
      "title": "Open registration, private",
      "description": "A limited seating, private event.",
      "location": "Rochester, New York",
      "start": "2015-08-29T12:30:00-04:00",
      "end": "2015-08-29T13:30:00-04:00",
      "score": null,
      "public": "no",
      "certificate": "no",
      "attending_count": "3",
      "attendees": {
        "user": {
          "321": {
            "id": "321",
            "firstname": "Jane",
            "lastname": "Doe",
            "email": "janedoe@example.com",
            "extra_registration": {
              "state": "New York"
            }
          },
          "426": {
            "id": "426",
            "firstname": "John",
            "lastname": "Smith",
            "email": "johnsmith@example.com",
            "extra_registration": {
              "state": "NY"
            }
          },
          "789": {
            "id": "789",
            "firstname": "User",
            "lastname": "Test",
            "email": "test_cn_422@example.com",
            "extra_registration": []
          }
        }
      },
      "registered_seats": {
        "user": {
          "321": {
            "id": "321",
            "firstname": "Jane",
            "lastname": "Doe",
            "email": "janedoe@example.com",
            "extra_registration": {
                "state": "New York"
            }
          },
          "426": {
            "id": "426",
            "firstname": "John",
            "lastname": "Smith",
            "email": "johnsmith@example.com",
            "extra_registration": {
                "state": "NY"
            }
          },
          "789": {
            "id": "789",
            "firstname": "User",
            "lastname": "Test",
            "email": "test_cn_422@example.com",
            "extra_registration": []
          }
        }
      },
      "seats": "3",
      "taken_count": "3",
      "category": "non-training"
    }
  ]
}

This endpoint registers a user into an event.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/event/<Event ID>/<User ID>

URL Parameters

Parameter Description
Event ID The ID of the event.
User ID The ID of the user.

Report

The simplest endpoint that we have available will be the reporting endpoint. This endpoint will provide data based on courses your users take. The data provided can be used to perform organization functions based off of conditionals which the client must establish.

Endpoint Logistics

Element Data Type Description
course course A course object.
score integer The user's score.
status string The user's status in the course. Valid values are not attempted, incomplete, complete, passed, failed, and browsed.
assignment_source string A string defining the method that a learner obtained the course. Valid values are:
  • Administrator
  • Self-Assigned
  • Site Registration
  • Reporting Group
  • Classroom
  • CollaborNation Customer Service
  • CollaborNation API
  • Unknown: This value usually comes from courses that predate assignment source recording.
finish_date integer The UNIX timestamp when the user first completed the course, or 0 if the course has never been completed.
time string The amount of time the user spent taking the course.

Update a user's course progress

Request

PUT https://collabornation.net/lms/api/0.08/report/42/128

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <report>
    <score>75</score>
    <status>completed</status>
    <time>0000:00:00</time>
  </report>
</request>
PUT https://collabornation.net/lms/api/0.08/report/42/128.json

{
  "report": {
    "score": "75",
    "status": "completed",
    "time": "0000:00:00"
  }
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <report>
    <course>
      <id>128</id>
      <title>Course Title</title>
      <score>75</score>
      <expiration xsi:nil="true"/>
    </course>
    <status>completed</status>
    <score>75</score>
    <time>0000:00:00</time>
    <course_link>https://collabornation.net/lms/api/0.08/learn/251</course_link>
    <link>https://collabornation.net/lms/api/0.08/learn/251</link>
  </report>
</response>
{
  "report": {
    "course": {
      "id": "128",
      "title": "Course Title",
      "score": "75",
      "expiration": "true"
    },
    "status": "completed",
    "score": "75",
    "time": "0000:00:00",
    "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
    "link": "https://collabornation.net/lms/api/0.08/learn/251"
  }
}

This endpoint manually updates a user’s course progress. This endpoint will only update if the course was assigned to the user through the API.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/report/<User ID>/<Course ID>

URL Parameters

Parameter Description
User ID The ID of the user.
Course ID The ID of the course.

Retrieve all users' course progress

Request

GET https://collabornation.net/lms/api/0.08/report
GET https://collabornation.net/lms/api/0.08/report.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <report>
      <course>
        <id>128</id>
        <title>Course Title</title>
        <score>75</score>
        <expiration xsi:nil="true"/>
      </course>
      <status>completed</status>
      <score>75</score>
      <time>0000:00:00</time>
      <assignment_source>CollaborNation API</assignment_source>
      <finish_date>1426537633</finish_date>
      <course_link>https://collabornation.net/lms/api/0.08/learn/251</course_link>
      <link>https://collabornation.net/lms/api/0.08/learn/251</link>
    </report>
    <report>
      <course>
        <id>129</id>
        <title>Another Course Title</title>
        <score>75</score>
        <expiration xsi:nil="true"/>
      </course>
      <status>completed</status>
      <score>80</score>
      <time>0000:00:00</time>
      <assignment_source>CollaborNation API</assignment_source>
      <finish_date>1383063542</finish_date>
      <course_link>https://collabornation.net/lms/api/0.08/learn/8682</course_link>
      <link>https://collabornation.net/lms/api/0.08/learn/8682</link>
    </report>
    <id>42</id>
    <firstname>John</firstname>
    <lastname>Smith</lastname>
    <email>johnsmith@example.com</email>
    <extra_registration/>
  </user>
  <user>
    <report>
      <course>
        <id>128</id>
        <title>Course Title</title>
        <score>75</score>
        <expiration xsi:nil="true"/>
      </course>
      <status>completed</status>
      <score>95</score>
      <time>0000:00:00</time>
      <assignment_source>CollaborNation API</assignment_source>
      <finish_date>1417631907</finish_date>
      <course_link>https://collabornation.net/lms/api/0.08/learn/251</course_link>
      <link>https://collabornation.net/lms/api/0.08/learn/251</link>
    </report>
    <id>321</id>
    <firstname>Jane</firstname>
    <lastname>Doe</lastname>
    <email>janedoe@example.com</email>
    <extra_registration>
      <state>New York</state>
    </extra_registration>
  </user>
</response>
{
  "user": [
    {
      "report": [
        {
          "course": {
            "id": "128",
            "title": "Course Title",
            "score": "75",
            "expiration": []
          },
          "status": "completed",
          "score": "75",
          "time": "0000:00:00",
          "assignment_source": "CollaborNation API",
          "finish_date": "1426537633",
          "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
          "link": "https://collabornation.net/lms/api/0.08/learn/251"
        },
        {
          "course": {
            "id": "129",
            "title": "Another Course Title",
            "score": "75",
            "expiration": []
          },
          "status": "completed",
          "score": "80",
          "time": "0000:00:00",
          "assignment_source": "CollaborNation API",
          "finish_date": "1383063542",
          "course_link": "https://collabornation.net/lms/api/0.08/learn/8682",
          "link": "https://collabornation.net/lms/api/0.08/learn/8682"
        }
      ],
      "id": "42",
      "firstname": "John",
      "lastname": "Smith",
      "email": "johnsmith@example.com",
      "extra_registration": []
    },
    {
      "report": {
        "course": {
          "id": "128",
          "title": "Course Title",
          "score": "75",
          "expiration": []
        },
        "status": "completed",
        "score": "95",
        "time": "0000:00:00",
        "assignment_source": "CollaborNation API",
        "finish_date": "1417631907",
        "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
        "link": "https://collabornation.net/lms/api/0.08/learn/251"
      },
      "id": "321",
      "firstname": "Jane",
      "lastname": "Doe",
      "email": "janedoe@example.com",
      "extra_registration": {
        "state": "New York"
      }
    }
  ]
}

This endpoint returns the status of all courses for all users in your organization. This endpoint only retrieves data of courses assigned to the user through the API.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/report

URL Parameters

There are no URL parameters.

Retrieve a user's progress on all courses

Request

GET https://collabornation.net/lms/api/0.08/report/42
GET https://collabornation.net/lms/api/0.08/report/42.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <report>
    <course>
      <id>128</id>
      <title>Sexual Harassment Prevention for Employees</title>
      <score>75</score>
      <expiration xsi:nil="true"/>
    </course>
    <status>completed</status>
    <score>75</score>
    <time>0000:00:00</time>
    <course_link>https://collabornation.net/lms/api/0.08/learn/251</course_link>
    <link>https://collabornation.net/lms/api/0.08/learn/251</link>
  </report>
  <report>
    <course>
      <id>129</id>
      <title>Another Course Title</title>
      <score>75</score>
      <expiration xsi:nil="true"/>
    </course>
    <status>completed</status>
    <score>80</score>
    <time>0000:00:00</time>
    <course_link>https://collabornation.net/lms/api/0.08/learn/8682</course_link>
    <link>https://collabornation.net/lms/api/0.08/learn/8682</link>
  </report>
</response>
{
  "response": {
    "report": [
      {
        "course": {
          "id": "128",
          "title": "Sexual Harassment Prevention for Employees",
          "score": "75",
          "expiration": []
        },
        "status": "completed",
        "score": "75",
        "time": "0000:00:00",
        "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
        "link": "https://collabornation.net/lms/api/0.08/learn/251"
      },
      {
      "course": {
        "id": "129",
        "title": "Another Course Title",
        "score": "75",
        "expiration": []
        },
        "status": "completed",
        "score": "80",
        "time": "0000:00:00",
        "course_link": "https://collabornation.net/lms/api/0.08/learn/8682",
        "link": "https://collabornation.net/lms/api/0.08/learn/8682"
      }
    ],
  }
}

This endpoint returns a user's progress on all courses in their account. This will only return courses that were assigned to the user through the API.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/report/<User ID>

URL Parameters

Parameter Description
User ID The ID of the user.

Retrieve a user's progress on a course

Request

GET https://collabornation.net/lms/api/X.XX/report/42/128
GET https://collabornation.net/lms/api/X.XX/report/42/128.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <report>
    <course>
      <id>128</id>
      <title>Sexual Harassment Prevention for Employees</title>
      <score>75</score>
      <expiration xsi:nil="true"/>
    </course>
    <status>completed</status>
    <score>75</score>
    <time>0000:00:00</time>
    <course_link>https://collabornation.net/lms/api/0.08/learn/251</course_link>
    <link>https://collabornation.net/lms/api/0.08/learn/251</link>
  </report>
</response>
{
  "response": {
    "report": {
      "course": {
        "id": "128",
        "title": "Sexual Harassment Prevention for Employees",
        "score": "75",
        "expiration": {
          "_xsi:nil": "true"
        }
      },
      "status": "completed",
      "score": "75",
      "time": "0000:00:00",
      "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
      "link": "https://collabornation.net/lms/api/0.08/learn/251"
    },
  }
}

This endpoint returns a user's progress on one course in their account. This will only return courses that were assigned to the user through the API.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/report/<User ID>/<Course ID>/

URL Parameters

Parameter Description
User ID The ID of the user.
Course ID The ID of the course.

Reporting Group

The reporting group endpoints allow you to interact with and manipulate the Reporting Groups section of the CollaborNation LMS. Reporting groups can be created, edited and deleted using these endpoints.

Endpoint Logistics

Element Data Type Description
group_id integer ID of the Reporting Group.
group_name string Name of the Reporting Group.
group_desc string Optional description of the Reporting Group.
group_parent string ID of the parent of the Reporting Group.

Retrieve all Reporting Groups

Request

GET https://collabornation.net/lms/api/0.08/reporting-group
GET https://collabornation.net/lms/api/0.08/reporting-group.json

Response

<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <reporting_group>
    <rgid>1406</rgid>
    <group_name>HR</group_name>
    <subgroups>
      <rgid>15203</rgid>
      <group_name>Abundant Living</group_name>
    </subgroups>
  </reporting_group>
  <reporting_group>
    <rgid>3458</rgid>
    <group_name>Sales</group_name>
  </reporting_group>
  <reporting_group>
    <rgid>7426</rgid>
    <group_name>Parks and Recreation</group_name>
  </reporting_group>
</response>
{
  "reporting_group": {
    "1406": {
        "rgid": "1406",
        "group_name": "HR"
        "subgroups": {
          "15203": {
              "rgid": "15203",
              "group_name": "Abundant Living"
            }
        }
    },
    "3458": {
        "rgid": "3458",
        "group_name": "Sales"
    },
    "7426": {
        "rgid": "7426",
        "group_name": "Parks and Recreation"
    }
  }
}

This endpoint returns all of the Reporting Groups belonging to your organization.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/reporting-group

URL Parameters

Parameter Data Type Data Format Description
group_name string text Retrieve a reporting group based on the name.

Retrieve a Reporting Group

Request

GET https://collabornation.net/lms/api/0.08/reporting-group/<Group ID>
GET https://collabornation.net/lms/api/0.08/reporting-group/<Group ID>.json

Response

<?xml version="1.0" encoding="UTF-8" ?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <reporting_group>
    <rgid>1406</rgid>
    <group_name>HR</group_name>
    <subgroups>
      <rgid>15203</rgid>
      <group_name>Abundant Living</group_name>
    </subgroups>
  </reporting_group>
</response>
{
  "reporting_group": {
    "1406": {
        "rgid": "1406",
        "group_name": "HR"
        "subgroups": {
          "15203": {
              "rgid": "15203",
              "group_name": "Abundant Living"
            }
        }
    }
  }
}

This endpoint returns a single Reporting Groups belonging to your organization.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/reporting-group/<Group ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.

Create a Reporting Group

Request

POST https://collabornation.net/lms/api/0.08/reporting-group

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <group_name>Management</group_name>
  <group_desc>Upper Management of South West Division</group_desc>
</request>
POST https://collabornation.net/lms/api/0.08/reporting-group

{
  "group_name": "SW Management",
  "group_desc": "Upper Management of the South West Division"
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group_id>4578</group_id>
</response>
{
  "group_id": 4578
}

This endpoint creates a Reporting Group with a given name and an optional description.

HTTP Request

POST https://collabornation.net/lms/api/<X.XX>/reporting-group

URL Parameters

There are no URL parameters.

Update a Reporting Group

Request

PUT https://collabornation.net/lms/api/0.08/reporting-group/4578

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <group_name>NE Management</group_name>
  <group_desc>Upper Management of North East Division</group_desc>
  <group_parent>4560</group_parent>
</request>
PUT https://collabornation.net/lms/api/0.08/reporting-group/4578.json

{
  "group_name": "NE Management",
  "group_desc": "Upper Management of North East Division",
  "group_parent": 4560
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <group_id>4578</group_id>
  <group_name>NE Management</group_name>
  <group_desc>Upper Management of North East Division</group_desc>
</response>
{
  "group_id": 4578,
  "group_name": "NE Management",
  "group_desc": "Upper Management of North East Division",
}

This endpoint updates a Reporting Group with a given Group ID. group_parent is optional and can be used to move a Reporting Group to a new parent.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/reporting-group/<Group ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.

Delete a Reporting Group

Request

DELETE https://collabornation.net/lms/api/0.08/reporting-group/4578
DELETE https://collabornation.net/lms/api/0.08/reporting-group/4578.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <group_id>4578</group_id>
</response>
{
  "group_id": 4578
}

This endpoint deletes a Reporting Group with a given name Group ID.

HTTP Request

DELETE https://collabornation.net/lms/api/<X.XX>/reporting-group/<Group ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.

Reporting Group User

The reporting group user endpoints allow you to modify roles and memberships of Reporting Groups of the CollaborNation LMS.

Endpoint Logistics

Element Data Type Description
user_id integer ID of the user.
group_id integer ID of the Reporting Group.

Retrieve all Reporting Group Members

Request

GET https://collabornation.net/lms/api/0.08/reporting-group-user/265
GET https://collabornation.net/lms/api/0.08/reporting-group-user/265.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <extra_100255>
    <id>100255</id>
    <mail>jdoe@company.com</mail>
    <fname>John</fname>
    <lname>Doe</lname>
    <enabled>1</enabled>
    <alias>users/john-doe</alias>
  </extra_100255>
</response>
{
  "100255": {
    "id": "100255",
    "mail": "jdoe@company.com",
    "fname": "John",
    "lname": "Doe",
    "enabled": "1",
    "alias": "users/john-doe"
  }
}

This endpoint returns all members of the given Reporting Group.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/reporting-group-user/<Group ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.

Add a User to a Reporting Group

Request

PUT https://collabornation.net/lms/api/0.08/reporting-group-user/265/100255
PUT https://collabornation.net/lms/api/0.08/reporting-group-user/265/100255.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <status>Reporting Group membership updated.</status>
</response>
{
  "status": "Reporting Group membership updated."
}

This endpoint adds a given user to a given Reporting Group.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/reporting-group-user/<Group ID>/<User ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.
User ID The ID of the User.

Delete a Reporting Group Member

Request

DELETE https://collabornation.net/lms/api/0.08/reporting-group-user/265/100255
DELETE https://collabornation.net/lms/api/0.08/reporting-group-user/265/100255.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <status>Reporting Group membership updated.</status>
</response>
{
  "status": "Reporting Group membership updated."
}

This endpoint removes a given user from a given Reporting Group.

HTTP Request

DELETE https://collabornation.net/lms/api/<X.XX>/reporting-group-user/<Group ID>/<User ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.
User ID The ID of the User.

Set a Reporting Group user as an Admin

Request

PUT https://collabornation.net/lms/api/0.08/reporting-group-user/set-admin/265/100255
PUT https://collabornation.net/lms/api/0.08/reporting-group-user/set-admin/265/100255.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <status>Reporting Group management updated.</status>
</response>
{
  "status": "Reporting Group management updated."
}

This endpoint elevates a user to a Reporting Group Admin.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/reporting-group-user/set-admin/<Group ID>/<User ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.
User ID The ID of the User.

Reset a Reporting Group Admin into a user

Request

PUT https://collabornation.net/lms/api/0.08/reporting-group-user/unset-admin/265/100255
PUT https://collabornation.net/lms/api/0.08/reporting-group-user/unset-admin/265/100255.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <status>Reporting Group management updated.</status>
</response>
{
  "status": "Reporting Group management updated."
}

This endpoint removes Reporting Group Admin privileges from a user.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/reporting-group-user/unset-admin/<Group ID>/<User ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.
User ID The ID of the User.

Set a Reporting Group user as a Manager

Request

PUT https://collabornation.net/lms/api/0.08/reporting-group-user/set-manager/265/100255
PUT https://collabornation.net/lms/api/0.08/reporting-group-user/set-manager/265/100255.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <status>Reporting Group management updated.</status>
</response>
{
  "status": "Reporting Group management updated."
}

This endpoint elevates a user to a Reporting Group Manager.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/reporting-group-user/set-manager/<Group ID>/<User ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.
User ID The ID of the User.

Reset a Reporting Group Manager into a user

Request

PUT https://collabornation.net/lms/api/0.08/reporting-group-user/unset-manager/265/100255
PUT https://collabornation.net/lms/api/0.08/reporting-group-user/unset-manager/265/100255.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <status>Reporting Group management updated.</status>
</response>
{
  "status": "Reporting Group management updated."
}

This endpoint removes Reporting Group Manager privileges from a user.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/reporting-group-user/unset-manager/<Group ID>/<User ID>

URL Parameters

Parameter Description
Group ID The ID of the Reporting Group.
User ID The ID of the User.

Record

The record endpoints are very similar to the report endpoints. The only difference between them is that record also returns information for courses that the user signed up for on their own, rather than just the records that were assigned to them through the API. They still require a course ID to be assigned through the nation for the course to be returned.

Endpoint Logistics

Element Data Type Description
course course A course object, as defined above.
score integer The user's score.
status string A string defining the user’s progress in the course. Valid values are not attempted, incomplete, complete, passed, failed, and browsed.
assignment_source string A string defining the method that a learner obtained the course. Valid values are:
  • Administrator
  • Self-Assigned
  • Site Registration
  • Reporting Group
  • Classroom
  • CollaborNation Customer Service
  • CollaborNation API
  • Unknown: This usually comes from courses that predate assignment source recording.
finish_date integer The UNIX timestamp when the user first completed the course, or 0 if the course has never been completed.
time integer The total amount of time the user has spent in the course.

Update a user's course progress

Request

PUT https://collabornation.net/lms/api/0.08/record/42/128

<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <record>
    <score>75</score>
    <status>completed</status>
    <time>0000:00:00</time>
  </report>
</record>
PUT https://collabornation.net/lms/api/0.08/record/42/128.json

{
  "report": {
    "score": "75",
    "status": "completed",
    "time": "0000:00:00"
  }
}

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <record>
    <course>
      <id>128</id>
      <title>Sexual Harassment Prevention for Employees</title>
      <score>75</score>
      <expiration xsi:nil="true"/>
    </course>
    <status>completed</status>
    <score>75</score>
    <time>0000:00:00</time>
    <course_link>https://collabornation.net/lms/api/X.XX/learn/251</ course_link>
    <link>https://collabornation.net/lms/api/X.XX/learn/251</link>
  </record>
</response>
{
  "report": {
    "course": {
      "id": "128",
      "title": "Course Title",
      "score": "75",
      "expiration": "true"
    },
    "status": "completed",
    "score": "75",
    "time": "0000:00:00",
    "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
    "link": "https://collabornation.net/lms/api/0.08/learn/251"
  }
}

This endpoint updates a single user's course progress. This will only update for courses defined in the API.

HTTP Request

PUT https://collabornation.net/lms/api/<X.XX>/record/<User ID>/<Course ID>

URL Parameters

Parameter Description
User ID The ID of the user.
Course ID The ID of the course.

Retrieve all users' course progress

Request

GET https://collabornation.net/lms/api/0.08/record
GET https://collabornation.net/lms/api/0.08/record.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <record>
      <course>
        <id>128</id>
        <title>Sexual Harassment Prevention for Employees</title>
        <score>75</score>
        <expiration xsi:nil="true"/>
      </course>
      <status>completed</status>
      <score>75</score>
      <time>0000:00:00</time>
      <assignment_source>CollaborNation API</assignment_source>
      <finish_date>1426537633</finish_date>
      <course_link>https://collabornation.net/lms/api/X.XX/learn/251</ course_link>
      <link>https://collabornation.net/lms/api/X.XX/learn/251</link>
    </record>
    <record>
      <course>
        <id>129</id>
        <title>Another Course Title</title>
        <score>75</score>
        <expiration xsi:nil="true"/>
      </course>
      <status>completed</status>
      <score>80</score>
      <time>0000:00:00</time>
      <assignment_source>CollaborNation API</assignment_source>
      <finish_date>1383063542</finish_date>            <course_link>https://collabornation.net/lms/api/X.XX/learn/8682</ course_link>
      <link>https://collabornation.net/lms/api/X.XX/learn/8682</link>
    </record>
    <record>
      <course>
        <id>190</id>
        <title>Foobar Course Title</title>
        <score>60</score>
        <expiration xsi:nil="true"/>
      </course>
      <status>completed</status>
      <score>70</score>
      <time>0000:00:00</time>
      <course_link>https://collabornation.net/lms/api/X.XX/learn/8618</ course_link>
      <link>https://collabornation.net/lms/api/X.XX/learn/8618</link>
    </record>
    <id>42</id>
    <firstname>User</firstname>
    <lastname>Test</lastname>
    <email>test_cn_42@example.com</email>
    <extra_registration/>
  </user>
  <user>
    <record>
      <course>
        <id>128</id>
        <title>Sexual Harassment Prevention for Employees</title>
        <score>75</score>
        <expiration xsi:nil="true"/>
      </course>
      <status>completed</status>
      <score>95</score>
      <time>0000:00:00</time>
      <assignment_source>CollaborNation API</assignment_source>
      <finish_date>1412933907</finish_date>
      <course_link>https://collabornation.net/lms/api/X.XX/learn/251</ course_link>
      <link>https://collabornation.net/lms/api/X.XX/learn/251</link>
    </record>
    <record>
      <course>
        <id>129</id>
        <title>Another Course Title</title>
        <score>65</score>
        <expiration xsi:nil="true"/>
      </course>
      <status>completed</status>
      <score>75</score>
      <time>0000:00:00</time>
      <assignment_source>CollaborNation API</assignment_source>
      <finish_date>1403833301</finish_date> <course_link>https://collabornation.net/lms/api/X.XX/learn/8689</ course_link>
      <link>https://collabornation.net/lms/api/X.XX/learn/8689</link>
    </record>
    <id>321</id>
    <firstname>John</firstname>
    <lastname>Doe</lastname>
    <email>johndoe@example.com</email>
    <extra_registration>
      <test>TESTING</test>
    </extra_registration>
  </user>
</response>
{
  "user": [
    {
      "report": [
        {
          "course": {
            "id": "128",
            "title": "Course Title",
            "score": "75",
            "expiration": []
          },
          "status": "completed",
          "score": "75",
          "time": "0000:00:00",
          "assignment_source": "CollaborNation API",
          "finish_date": "1426537633",
          "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
          "link": "https://collabornation.net/lms/api/0.08/learn/251"
        },
        {
          "course": {
            "id": "129",
            "title": "Another Course Title",
            "score": "75",
            "expiration": []
          },
          "status": "completed",
          "score": "80",
          "time": "0000:00:00",
          "assignment_source": "CollaborNation API",
          "finish_date": "1383063542",
          "course_link": "https://collabornation.net/lms/api/0.08/learn/8682",
          "link": "https://collabornation.net/lms/api/0.08/learn/8682"
        }
      ],
      "id": "42",
      "firstname": "John",
      "lastname": "Smith",
      "email": "johnsmith@example.com",
      "extra_registration": []
    },
    {
      "report": {
        "course": {
          "id": "128",
          "title": "Course Title",
          "score": "75",
          "expiration": []
        },
        "status": "completed",
        "score": "95",
        "time": "0000:00:00",
        "assignment_source": "CollaborNation API",
        "finish_date": "1417631907",
        "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
        "link": "https://collabornation.net/lms/api/0.08/learn/251"
      },
      "id": "321",
      "firstname": "Jane",
      "lastname": "Doe",
      "email": "janedoe@example.com",
      "extra_registration": {
        "state": "New York"
      }
    }
  ]
}

This endpoint returns all users' course progress. This will only return courses defined in the API.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/record

URL Parameters

There are no URL parameters

Retrieve a user's progress on a course

Request

GET https://collabornation.net/lms/api/0.08/record/42/190
GET https://collabornation.net/lms/api/0.08/record/42/190.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <record>
    <course>
      <id>190</id>
      <title>Foobar Course Title</title>
      <score>60</score>
      <expiration xsi:nil="true"/>
    </course>
    <status>completed</status>
    <score>70</score>
    <time>0000:00:00</time>
    <course_link>https://collabornation.net/lms/api/X.XX/learn/8618</course_link>
    <link>https://collabornation.net/lms/api/X.XX/learn/8618</link>
  </record>
</response>
{
  "response": {
    "report": {
      "course": {
        "id": "128",
        "title": "Sexual Harassment Prevention for Employees",
        "score": "75",
        "expiration": {
          "_xsi:nil": "true"
        }
      },
      "status": "completed",
      "score": "75",
      "time": "0000:00:00",
      "course_link": "https://collabornation.net/lms/api/0.08/learn/251",
      "link": "https://collabornation.net/lms/api/0.08/learn/251"
    },
  }
}

This endpoint returns all users' course progress. This will only return courses defined in the API.

HTTP Request

GET https://collabornation.net/lms/api/X.XX/record/<User ID>/<Course ID>

URL Parameters

Parameter Description
User ID The ID of the user.
Course ID The ID of the course.

Time

Get the system time

Request

GET https://collabornation.net/lms/api/0.08/time
GET https://collabornation.net/lms/api/0.08/time.json

Response

<?xml version="1.0"?>
<response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <time>1417707657</time>
</response>
{
  "time": 1545176592
}

This endpoint returns the current system time in seconds elapsed since the Unix Epoch, in UTC. This can be used to compare against expiration dates.

HTTP Request

GET https://collabornation.net/lms/api/<X.XX>/time

URL Parameters

There are no URL parameters.

API Responses

The CollaborNation API uses the following status codes for requests:

Status Code Description Cause
200 OK The request succeeded. n/a
201 Created A POST method successfully created a resource. n/a
400 Bad Request Request is not well-formed, syntactically incorrect, or violets schema. The server could not understand the request. Indicates one of these conditions:
  • The data is not in the expected format.
  • A required field is not available.
  • A data validation error occurred.
401 Unauthorized Authentication failed due to invalid authentication credentials. The request requires authentication and the caller did not provide valid credentials.
403 Forbidden Authorization failed due to insufficient permissions. The client is not authorized to access this resource although it might have valid credentials.
404 Not Found The specified resource does not exist. The server did not find anything that matches the request URI. Either the URI is incorrect or the resource is not available. For example, no data exists in the database at that key.
405 Method Not Allowed The server does not implement the requested HTTP method. The service does not support the requested HTTP method.
415 Unsupported Media Type The server does not support the request payload’s media type. The API cannot process the media type of the request payload. For example, this error occurs if the client sends a Content-Type: application/xml request header but the API can only accept application/json request payloads.
429 Too Many Requests The rate limit has been reached. Blocked due to rate limiting. The rate limit for the user, application, or token exceeds a predefined value.
500 Internal Server Error An internal server error has occurred. A system or application error occurred. Although the client appears to provide a correct request, something unexpected occurred on the server.
501 Not Implemented The request method is not supported by the server and cannot be handled. n/a

Sample PHP Code

<?php

$username = 'API_USERNAME';
$password = 'API_PASSWORD';

$url = 'https://collabornation.net/lms/api/0.08/user/321/';
$method = 'PUT'; // VALUES: 'GET', 'POST', 'PUT'
$accept= 'text/xml'; // For JSON use 'application/json'

// XML format for $request is the default method accepted and returned
$request = '<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <user>
    <id>321</id>
    <firstname>John</firstname>
    <lastname>Doe</lastname>
    <email>john.doe@example.com</email>
  </user>
</request>';

/*
 * JSON example of the above
 */
/*
$request = '{
  "user": {
    "id": "321",
    "firstname" : "John",
    "lastname"  : "Doe",
    "email"     : "john.doe@example.com"
  }
}';
*/

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
switch ($method) {
  case 'GET':
    curl_setopt($ch, CURLOPT_HTTPGET, true);
    break;
  case 'POST':
    curl_setopt($ch, CURLOPT_POST, true);
    break;
  // Do NOT include a method for PUT
  default:
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
}

// Only include the next two if you’re on a development machine
// that doesn’t have certificates defined (usually this is not defined in Windows)
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$header = array();
$header[] = "Accept: $accept";
if (!empty($request)) {
  $header[] = "Content-Length: " . strlen($request);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

/*
 * Add debugging options to Curl request. Remove in production.
 * Additional debug options begin.
 */
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$verbose = fopen('php://temp', 'rw+');
curl_setopt($ch, CURLOPT_STDERR, $verbose);
rewind($verbose);
$verboseLog = stream_get_contents($verbose);
/*
 * Additional debug options end.
 */

// Perform the request.
$result = curl_exec($ch);

/*
 * Gather the curl request info and display the curl response,
 * the curl request info, the error number, the human readable response to the error number,
 * and anything PHP wrote to the STDERR log. The latter two should not be necessary in production.
 *
 * curl_errno($ch) will return 0 when there are no errors.
 * If there are errors then the $info and the error string may be useful.
 *
 * $verboseLog was defined in the debug options block above.
 */
$info = curl_getinfo($ch);
var_dump($result, $info, curl_errno($ch), curl_strerror(curl_errno($ch), $verboseLog));

// Close the curl connection.
curl_close($ch);

$token = trim(strip_tags($result));

// Take the user to the learn page
// $method = 'PUT';
// $url = 'https://blepore.collabornation.net/lms/api/0.05/learn/12312';

// Take the user to their My Courses page
$method = 'GET';
$url = 'https://blepore.collabornation.net/lms/api/0.08/my-courses';

$request = '<?xml version="1.0"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<token>' . $token . '</token>
</request>';
$url .= '?token=' . $token;
header("Location: " . $url);
exit;

?>

The following code shows how to create a new user and implement Single Sign-On to take the person to the My Courses page. You will need to change the following: