The VideoTile API

Welcome to the VideoTile API documentation.

The VideoTile API allows you to automate your workflow with the VideoTile Learning Management System. The current API features are:

It is assumed that you're using the VideoTile SDK for the PHP examples.

Public Routes

  • List all courses
  • List specific courses
  • User authentication with VideoTile

Authenticated Routes

  • List an authenticated users courses stored with VideoTile

Admin Routes

  • List all users
  • Create a user
  • View a specific user
  • View a users courses
  • View a specific user course
  • Enable or disable a users account

Each request sent to the requires the vendor_id parameter.

Endpoint
api.videotilehost.com

List courses

You can return an array of all available courses within your LMS.

POST
/courses

Example request

$api->getCourses();

Example request body

{
  "vendor_id": "vendor"
}

Example response

[
  {
    "id": 1,
    "name": "Basic Legionella Management",
    "description": "Explaining the background to Legionella and Legionnaires' Disease, the potential risks associated with water systems and how these can be prevented or controlled.",
    "duration": 75,
    "rrp": "65.00"
  },
  {
    "id": 2,
    "name": "Asbestos Awareness",
    "description": "As well as informing you about the risks of working with asbestos, the course will deliver a lot more information about: Recognising asbestos, where it's used, minimising the risks and the legislation about working with asbestos.",
    "duration": 65,
    "rrp": "35.00"
  },
]

Retrieve a course

Returns an object of a single course, specified by the request ID.

POST
/courses/{id}

Example Request

$api->getCourseById(1);

Example request body

{
  "id": 1,
  "vendor_id": "vendor"
}

Example response

{
  "id": 1,
  "name": "Basic Legionella Management",
  "description": "Explaining the background to Legionella and Legionnaires' Disease, the potential risks associated with water systems and how these can be prevented or controlled.",
  "duration": 75,
  "rrp": "65.00"
}

Authenticate a user

Returns a unique API token which is used for 'personal' requests for the user.

You should store this token, as it will be required for other routes which are protected by an authentication middleware, tokens are automatically generated.

POST
/login

Example request body

{
  "username": "johndoe",
  "password": "password",
  "vendor_id": "vendor"
}

Example Request

$api->authenticateUser($username, $password);

Example response

{
 "token": "generated-token"
}

List authenticated user courses

Returns an array of all courses related to the authenticated user.

The 'api_token' parameter is required for this request.

POST
/my/courses

Example request body

{
  "token": "token",
  "vendor_id": "vendor",
  "api_token": "token"
}

Example Request

$api->getMyCourses($token);

Example response

{
 "courses": [
   {
     "user_course_id": 1,
     "course_name": "Basic Legionella Management",
     "course_description": "Explaining the background to Legionella and Legionnaires' Disease, the potential risks associated with water systems and how these can be prevented or controlled.",
     "user_course_percentage": 0
   }
 ]
}

Log a user into the LMS

The API provides support with automatically logging in a user to the VideoTile LMS, you must use the users Auth Token for this.

An auth token lasts for 60 minutes, and will be automatically created on specific API routes, such as /my/courses and initial user auth.

The auth token is different to the users standard API token.

POST
/my/lms-login

Example request body

{
  "api_token": "random-generated-token",
  "vendor_id": "vendor"
}

Example Request

$api->generateAuthToken($token);

Example response

{
  "token": "token"
}

List users

An array with all users in the database will be returned, an additional 'admin token' is required, this is provided by VideoTile upon initial installation.

An 'admin_token' parameter is required for all admin requests.

POST
/admin/users/list

Example Request

$api->getUserList($token);

Example request body

{
  "vendor_id": "vendor",
  "admin_token": "admin_token"
}

Example response

[
  {
    "id": 393,
    "userid": "johndoe",
    "date": "2019-02-21 12:31:36",
    "name": "johndoe",
    "firstname": "John",
    "lastname": "Doe",
    "fullname": "John Doe",
    "logindate": "2019-02-21 12:31:36",
    "disabled": 1,
    "api_token": "token"
  },
  {
    "id": 394,
    "userid": "janedoe",
    "date": "2019-02-21 12:31:45",
    "name": "janedoe",
    "firstname": "Jane",
    "lastname": "Doe",
    "fullname": "Jane Doe",
    "logindate": "2019-02-21 12:31:45",
    "disabled": 0,
    "api_token": "token"
  }
]

Create a user

Creates a new user with the given payload.

Property Description
first_name the first name of the customer
last_name the last name of the customer
email the email address of the customer
telephone the telephone of the customer, this is an optional field.
POST
/admin/users/create

Example Request

$api->createUser([
    'first_name' => 'John',
    'last_name' => 'Doe',
    'email' => 'john@doe.com',
    'telephone' => '0123456789'
]);

Example request body

{
  "first_name": "John",
  "last_name": "Doe",
  "email": "john@doe.com",
  "vendor_id": "vendor",
  "admin_token": "admin_token",
  "telephone": "0123456789"
}

Example response

{
  "user_id": "1",
  "username": "johndoe",
  "api_token": "generated-token"
}

Retrieve a user

Returns a single user.

POST
/admin/users/user/{id}

Example request body

{
  "id": 1,
  "vendor_id": "vendor",
  "admin_token": "admin_token"
}

Example Request

$api->getUserById(1);

Example response

{
  "id": 393,
  "userid": "johndoe",
  "date": "2019-02-21 12:31:36",
  "name": "johndoe",
  "firstname": "John",
  "fullname": "John Doe",
  "logindate": "2019-02-21 12:31:36",
  "disabled": 1,
  "api_token": "token"
}

Fetch a users courses

Returns an array of all courses this user has enrolled to.

POST
/admin/users/user/{id}/courses

Example request body

{
  "id": 1,
  "vendor_id": "vendor",
  "admin_token": "admin_token"
}

Example Request

$api->getUserCoursesById($userId);

Example response

{
  "courses": [
    {
      "user_course_id": 1,
      "course_name": "Basic Legionella Management",
      "course_description": "Explaining the background to Legionella and Legionnaires' Disease, the potential risks associated with water systems and how these can be prevented or controlled.",
      "user_course_percentage": 0
    }
  ]
}

Fetch a specific user course

Returns an array of all courses this user has enrolled to.

POST
/admin/users/user/user/{id}/courses/{course_id}

Example request body

{
  "id": 1,
  "course_id": 1,
  "vendor_id": "vendor",
  "admin_token": "admin_token"
}

Example Request

$api->getUserCourseByCourseId($userId, $courseId);

Example response

{
  "course": {
    "usercourseid": 1,
    "usrid": 393,
    "userid": "craigsledmore",
    "groupid": 0,
    "courseid": 1,
    "usercoursedate": "2019-02-27 00:02:28",
    "certificatedate": "2019-02-27 00:02:28",
    "certificatecode": "",
    "failed": 0,
    "percentage": 0,
    "user": {
      "id": 393,
      "userid": "johndoe",
      "date": "2019-02-21 12:31:36",
      "name": "johndoe",
      "firstname": "John",
      "lastname": "Doe",
      "email": "john@doe.com",
      "fullname": "John Doe",
      "logindate": "2019-02-21 12:31:36",
      "disabled": 1,
      "api_token": "1212"
    },
    "course": {
      "courseid": 1,
      "coursename": "Basic Legionella Management",
      "coursedescrip": "Explaining the background to Legionella and Legionnaires' Disease, the potential risks associated with water systems and how these can be prevented or controlled.",
      "courseDuration": 75,
      "rrp": "65.00"
    }
  }
}

Disable a users account

Should you need to disable a users account, you can send a POST request to the displayed endpoint which will update the disabled field in the VideoTile LMS.

POST
/admin/users/user/{id}/disable

Example request body

{
  "id": 1,
  "vendor_id": "vendor",
  "admin_token": "admin_token"
}

Example Request

$api->disableUserAccountById($userId);

Example response

{
  "success": "Account successfully disabled."
}

Enable a users account

You may also find you need to quickly re-enable a users LMS access, you can do that with this route.

POST
/admin/users/user/{id}/enable

Example request body

{
  "id": 1,
  "vendor_id": "vendor",
  "admin_token": "admin_token"
}

Example Request

$api->enableUserAccountById($userId);

Example response

{
  "error": "This account is currently not disabled."
}

Assign a course to a user

This request call allows you to assign a course to a users account.

POST
/admin/course/assign

Example request body

{
  "user_id": "1",
  "course_id": "1"
}

Example Request

$api->assignCourseByUserId($userId, $courseId);

Example response

{
  "success":" Course successfully assigned to the user",
  "user_course_id": 20
}
Show examples in:
VT
VideoTile API Documentation