Skip to main content

What is an API?

🦉 API integration ✓ Uses ✓ Examples ✓

Here we explain everything about (our) API with some nice examples, how you can use it, and why you should use it.

1. What is API?

API stands for Application Programming Interface. It is the interface that allows software applications to communicate with each other. It basically allows you to request something, or ask a question, after which the API call performs the action it's supposed to do, after you have provided it with information.

Example

Imagine you’re sitting at a table in a restaurant with a menu of choices to order from. The kitchen is the part of the 'system' that will prepare your order. What is missing is the critical link to communicate your order to the kitchen and deliver your food back to your table. That’s where the waiter, or API, comes in. The waiter is the messenger – or API – that takes your request or order and tells the kitchen – the system – what to do. Then the waiter delivers the response back to you; in this case, it is the food.

To summarize, when a company offers an API to their customers, it just means that they’ve built a set of dedicated URLs that return pure data responses — meaning the responses won’t contain the kind of presentational overhead that you would expect in a graphical user interface like a website.

2. What API calls does Easy LMS have?

We have five API calls which serve different functions.

3. What does an API call consist of?

An API call consists of three things:

  • The payload (the actual data that is sent)

  • The endpoint (the address to which the data is sent)

  • The response (success or error response)

The payload is the information that is sent to an endpoint, meaning the data required to add a participant.

The endpoint is a web address which the information is sent to, and the response indicates whether the API call was successful or not.

4. Using webhooks in conjunction with API calls

Webhooks can be used in conjunction with API calls to initiate different actions. When a webhook is sent that contains the required payload for a certain API call to work, the API call will do its work and add the participant. The webhooks must be sent from your system to our endpoint and have to be set up yourself in your system.

Example 1 - course, exam, academy

The following paragraphs are part of a fictional use case to explain how webhooks and APIs can work together.

An HR manager has created an entry-level course and exam for newly hired employees. The HR manager wants the employees to take the course, but only wants them to gain access to the exam after completing the course. Only after passing the exam do they want the employees to have access to the academy, which contains intermediate and expert-level courses and exams. So, how do they set this up?

To understand how to set this up we have already established that these webhooks and API calls will be sent internally within the Easy LMS system. The process is as follows.

The HR manager has to create a webhook that sends a payload to the exam API after the employee completes the course. This webhook only has to contain the data needed to trigger the exam API call. In this case, we use the Add participant to Exam (invite) API call. When this webhook has been sent, the API call will be triggered if there's a success response. The API call adds the participant and sends the exam invitation automatically.

The second webhook the HR manager must create is for when the employee passes the exam successfully to gain access to the academy. Again, this webhook's payload should only contain the information the academy API call needs to add the participant and send an invitation. After sending this webhook, the academy API call will be triggered, after which it adds the participant to the academy and sends an invitation.

To summarize:

  1. Create webhook for course completion which is sent to the exam API call.

  2. Create webhook for passing exam which is sent to the academy API call.

  3. Employee takes course and completes it.

  4. Webhook for course completion is sent to Add participant to Exam (invite) API call endpoint and adds and invites participant to the exam.

  5. Employee takes exam and passes.

  6. Webhook for passing exam is sent to Add participant to Academy (invite) API call endpoint and adds and invites participant to the academy.

Example 2 - Sending invitations from your own system

A client wants to use our tool for training their (new) employees. They currently use the A predefined group of participants setting to send invitation emails. However, many employees perceive these invitations as spam, and some of these emails also end up in their spam folders. The client wants to send these invitations from their own system instead.

The client first creates a webhook that sends a payload to the Exam API - add participant without notifying. When a new employee is added to your system, the webhook sends the payload to the exam API which adds the employee. The API call does not send an invitation to this employee. When the API call is successful, the response includes login credentials. These login credentials must then be sent to the employee from your own system and mail application.

This also works for existing employees, you just need to create a webhook that sends a payload to the exam API which triggers the action of adding participants without notifying to the exam. The login credentials returned in the response of the API call can then be sent from your own system.

Example 3 - Selling exams

A client creates exams in our system and sells them to their own customers from their e-commerce website. They want to automate this after customers pay for an exam.

To automate the sales process they will need to use a webhook. When their customers purchase or pay for an exam on their e-commerce website, they are added to their system. The webhook they create must be triggered after they have paid. This webhook will then send the relevant payload to the exam API call and must return either a success or error response. If it's a successful response, the API call adds and invites customers to the exam they paid for.

5. What are the API call specifications?

Our API accepts application/x-www-form-urlencoded or multipart/form-data and json.

Find out more in the following articles:

Did this answer your question?