Requesting an Access Token for REST API Usage
The LMS API endpoints in the Swagger documentation can essentially be divided into 3 different categories:
lms-calls
openlms-calls
systems-calls
All these endpoints can be accessed via the base URL with the addition of /ils/restapi. The URLs for these three categories of endpoints are accordingly:
{{baseUrl}}/ils/restapi/lms{{baseUrl}}/ils/restapi/openlms{{baseUrl}}/ils/restapi/systems
OpenLMS calls do not require any authentication. LMS calls, on the other hand, require either basic authentication with a username and password or a Bearer Token with password grant, which can be generated in various ways. Systems calls, however, can only be used with a Bearer Token with client_credentials grant.
The IDM handles identity management within the LMS ecosystem. To create a Bearer Token, the following IDM endpoint can be used:
POST {{baseUrl}}/idm/oauth/token
To obtain a Bearer Token with password grant, the following x-www-form-urlencoded body must be provided:
grant_type | password |
client_id |
|
client_secret |
|
username |
|
password |
|
For a Bearer Token with client_credentials grant, the following body is sufficient, also x-www-form-urlencoded:
grant_type |
|
client_id |
|
client_secret |
|
You can use the client_id ILS, IDM or ILP. The corresponding client_secret can be looked up in the configuration files of your system.
Example calls for requesting a Bearer Token can be found in this postman collection:
Access tokens.postman_collection.json
The response containing the access_token is always a JSON object with the following fields:
"access_token"
"token_type"
"expires_in"