Discover the API, its structure and the use of SSO (Lära et Via HTML)

TABLE OF CONTENTS
Introduction
Enabling the API in your Lära LMS environment
Making an API call
Handling errors
   Generic error code descriptions
Managing custom fields for API calls

Notes
I. For security reasons, please ask your implementation advisor for assistance in accessing the API of your Lära LMS environment;
II. Please note that the masculine gender is used generically in the support articles to keep the content concise.

Introduction


 

Lära LMS provides an API that lets you call its functions from any system in order to manage its various components. The following sections give technical teams all the information they need to develop a bridge between their system and Lära LMS using the API.

Enabling the API in your Lära LMS environment

To use the Lära LMS API, it must be enabled and the IP addresses of incoming calls must be authorized. You can ask your implementation advisor for assistance with these operations.
To enable the API in your environment and authorize yourself to make API calls, go to the « Advanced settings » tab of the « Administration » menu, then to the « API » tab. From the API list, click the « Add an API » button. Fill in the following options: 
  • Name: give your new API an administrative name;
  • Type: you can ignore this setting. At this time, only full access can be granted.
  • Authorized addresses: to make API calls, your IP address or that of the system used for the calls must be authorized. Click « Add an IP address », then enter the IP address or addresses to authorize.

IMPORTANT: To add an address range, please use the following syntax: 127.0.0.1-127.0.0.100

Click « Create » to create your new API.

Making an API call

API calls can be made to Lära LMS manually or with a script, from software such as Postman or from a gateway within your organization.
The recommended structure for calls to Lära LMS is simple: 

Handling errors

When errors occur during API calls to Lära LMS, the system returns the following generic structure:

{
  "errors": {
    "message": "Invalid userId",
    "code": 39
  }
}

Generic error code descriptions

Number

Message

Comments/description

1

Required id

You must provide an ID.

2

Invalid id

The ID provided is invalid.

3

Invalid country

The country provided is invalid.

4

Invalid state

The province or state provided is invalid.

5

Required state

The province or state is required.

6

Custom field required

The custom field shown in the error message is required.

7

Custom field does not exists

The custom field shown in the error message does not exist.

8

Custom field cannot receive null

The custom field shown in the error message cannot accept a null value.

9

Custom field value is not “Type”

The value provided for the custom field shown in the error message is not the same type as the field.

10

Custom field is not a valid value of this list value

The value provided for the custom field shown in the error message is not included in the list of values.

11

Custom field value is not a valid country

The value provided for the custom field shown in the error message is not a valid country.

12

Action empty

You must provide an action with your request.

13

Json data invalid : message

The JSON is invalid. See the error message for more details.

14

Action processor not found

The processor associated with your action was not found.

15

Api processor not found

The processor provided was not found.

16

ApiID is empty

You must provide an ID for the API.

17

Invalid ApiID

The ID provided for the API is invalid.

18

Invalid Url

The URL provided is invalid.

19

Invalid IP

The IP address provided is invalid.

20

message

The message will indicate what the error is.

21

Custom field value is not a valid Location

The value provided for the custom field shown in the error message is not a valid location.

22

Missing search value

No search field value is specified.

23

Unexpected Failure

An unexpected error occurred while processing a request.

24Invalid ColorThe colour value provided is invalid.
25Invalid Color LengthThe colour length provided is invalid.
26Invalid DateThe date value is outside the supported range.

Managing custom fields for API calls

You can attach your own data to the various components of the Lära system using « custom fields ». To create or manage custom fields, go to the « Advanced settings » tab of the « Administration » menu, then to « Custom fields ».
For each custom field created, you can define the ID used in the API to make your various calls. These custom fields are presented in the other API articles corresponding to the various components.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.