Access API


Introduction

The Access API covers several groups of sub-APIs.

3 access control APIs:

  • The Stores API which can be used to manage multiple stores
  • The Clients API which can be used to manage clients and their permissions
  • The Users API which can be used to manage users and their permissions

3 connector APIs:

Getting access to the API

The Access API is enabled globally by default, and can be disabled with the ACCESS_API config option set to false.

It is fully accessible to all the clients which have the access/all permission enabled.

The API endpoints rely on the base endpoint of each client. In this documentation, we will designate the base endpoint by <base-endpoint>. To get the base endpoint of a client:

  • Go to the Access > API Consumers > Clients page.
  • Click on the (i) icon of a client.
  • The endpoint is indicated next to the Base endpoint label.

Stores API

Creating a store

Use the POST method on <base-endpoint>/stores with the following JSON props:

Param Description
slug Required string.
name Required string.

Updating a store

Use the PUT method on <base-endpoint>/stores/<store-id> with the same above content, except slug which can't be modified.

Getting the stores

Use the GET method on <base-endpoint>/stores.

Getting a store

Use the GET method on <base-endpoint>/stores/<store-id>.

Clients API

Creating a client

Use the POST method on <base-endpoint>/clients with the following JSON props:

Param Description
slug Required string.
name Required string.
guard Required string: basic-http, cmi5-token.
credentials JSON object with username and password properties (min length of 8 chars).
cors Optional string.
permissions JSON object with permission settings (e.g. {"xapi/statements/write": true, "xapi/statements/read/mine": true}).
pipeline JSON object with xAPI pipeline settings (e.g. {"validate_statements": true, "check_conflicts": true}).
store Required slug of store.

Updating a client

Use the PUT method on <base-endpoint>/clients/<client-id> with the same above content, except slug which can't be modified.

Getting the clients

Use the GET method on <base-endpoint>/clients.

Getting a client

Use the GET method on <base-endpoint>/clients/<client-id>.

Deleting a client

Use the DELETE method on <base-endpoint>/clients/<client-id>.

Users API

Creating a user

Use the POST method on <base-endpoint>/users with the following JSON props:

Param Description
firstname Required string.
lastname Required string.
email Required email. Must be unique in the database.
password Required string (min length of 8 chars).
agent Optional JSON encoded xAPI agent.
role Required string: actor, analyst, manager, supervisor, admin.
stores Required JSON encoded array of store slugs the user has access to.

Updating a user

Use the PUT method on <base-endpoint>/users/<user-id> with the same above content, except that the password are optional.

Getting the users

Use the GET method on <base-endpoint>/users.

Getting a user

Use the GET method on <base-endpoint>/users/<user-id>.

Deleting a user

Use the DELETE method on <base-endpoint>/users/<user-id>.

LRS Connections API

Creating an LRS connection

Use the POST method on <base-endpoint>/connections/lrs with the following JSON props:

Param Description
name Required string.
endpoint Required URL. The endpoint of the targeted LRS.
username Required string. The BasicHTTP username.
password Required string. The BasicHTTP password.

Updating an LRS connection

Use the PUT method on <base-endpoint>/connections/lrs/<connection-id> with the same above content, except that the username and password are optional.

Getting the LRS connections

Use the GET method on <base-endpoint>/connections/lrs.

Getting an LRS connection

Use the GET method on <base-endpoint>/connections/lrs/<connection-id>.

Deleting the LRS connections

Use the DELETE method on <base-endpoint>/connections/lrs.

Deleting an LRS connection

Use the DELETE method on <base-endpoint>/connections/lrs/<connection-id>.

Database Connections API

Creating a database connection

Use the POST method on <base-endpoint>/connections/db with the following JSON props:

Param Description
name Required string.
driver Required string: mysql, pgsql, mongodb, elasticsearch, opensearch.
host Required string. The host of the targeted database.
username Optional string. Credentials of the targeted database.
password Optional string. Credentials of the targeted database.
prefix Optional string. Prefix applicable to the table names.

Updating a database connection

Use the PUT method on <base-endpoint>/connections/db/<connection-id> with the same above content.

Getting the database connections

Use the GET method on <base-endpoint>/connections/db.

Getting a database connection

Use the GET method on <base-endpoint>/connections/db/<connection-id>.

Deleting the database connections

Use the DELETE method on <base-endpoint>/connections/db.

Deleting a database connection

Use the DELETE method on <base-endpoint>/connections/db/<connection-id>.

File Connections API

Creating an file connection

Use the POST method on <base-endpoint>/connections/file with the following JSON props:

Param Description
name Required string.
folder Required string. The path of a folder.
prefix Optional string. Prefix applicable to the file names.

Updating an file connection

Use the PUT method on <base-endpoint>/connections/file/<connection-id> with the same above content.

Getting the file connections

Use the GET method on <base-endpoint>/connections/file.

Getting an file connection

Use the GET method on <base-endpoint>/connections/file/<connection-id>.

Deleting the file connections

Use the DELETE method on <base-endpoint>/connections/file.

Deleting an file connection

Use the DELETE method on <base-endpoint>/connections/file/<connection-id>.