Skip to main content

External API: Create an individual board for each sign up through an external platform

This documentation was last updated: 2710.2022   Please note that depending on your organization active location the API address will be d...

Updated today

This documentation was last updated: 2710.2022

Please note that depending on your organization active location the API address will be different. In general, it will be either api.claned.com, api-germany.claned.com or api-asia.claned.com. So you need to modify the example calls in provided in this document accordingly. You can find each documentation with the correct formatting in the following locations:

This document will cover the workflow for more robust integration with a e-commerce platform or a enrollment system.

Prerequisites

The REST API documentation for Claned can be found at: https://api.claned.com/apidocs/index.html

The API-key can be retrieved from the Admin panel of your organization in Claned. If you need help retrieving the key, please contact us at [email protected]

The workflow covered in this document will be following

  • Customer purchases a course access through ecommerce platform (not in Claned)

  • A group in Claned is created for the customers

  • Customer will have an account created for them

  • A course is published to the group that was created

  • User is added to the group

Account = account is the details that the customer is going to use when login to Claned. In this example and account is created for the user

Groups = used to organize visibility of content for users inside Claned. In this case each user will have their own group where the purchased course is shared to.

Board = in Claned courses are called boards. Boards are used to share the learning content to the user.

Creating an account for the customer

Example payload:

{

"email": “[email protected]”,

"username": “[email protected]”,

"first_name": “John”,

"last_name": “Smith”,

"password": “Password123”

}

Example cURL:

curl -X POST "https://api.claned.com/external/v1/Users/Register" -H "accept: */*" -H "Authorization: APIKEY" -H "Content-Type: application/json-patch+json" -d "{\"email\":\"[email protected]\",\"username\":\"[email protected]\",\"first_name\":\"John\",\"last_name\":\"Smith\",\"password\":\"Password123\"}"

Example response:

Code 201

{

"email": "[email protected]",

"username": "[email protected]",

"name": "John Smith",

"id": 4277,

"born_at": null,

"country": null,

"sex": "m",

"warning": null

}

Creating a group for the customer

A group for the customer is created with:

You can for example use the email of the customer as the group name. This group is needed to later share the purchased content to. An ID for the group is set automatically when creating the group.

Example payload

{

"name": "John Smith"

}

Example cURL

curl -X POST "https://apiclaned.com/external/v1/Groups/144" -H "accept: text/plain" -H "Authorization: APIKEY" -H "Content-Type: application/json-patch+json" -d "{\"name\":\"John Smith\"}"

Retrieving the group id for the created group

The id can be retrieved with:

This id is required so that:

  • A user can be added to the group

  • A board (the content) can be shared to the group

Example payload:

{

"id": 262,

"name": "John Smith",

"board_ids": []

}

Example cURL:

curl -X GET "https://api.claned.com/external/v1/Groups/144?Query=John%20Smith" -H "accept: text/plain" -H "Authorization: APIKEY"

We now have id for the group we created. Use the name of board created as the name in the payload.

Save the id result to be used in the next steps.

Adding user to the group

To add user to the correct group, you need the group_id from previous part. In this part can be set an access period to the content. You can use expires_at or access_days. This can be hardcoded in your integration to your preference. Email should be the email that user was created with in the first step.

Example payload (use only expires_at or access_days):

{

"group_id": 262,

"email": " [email protected] ",

"expires_at": "2020-10-15T09:30:36.766Z",

"access_days": 0,

}

Example cURL (does not include expires_at or access_days):

curl -X POST "https://apiclaned.claned.com/external/v1/Users/invite" -H "accept: */*" -H "Authorization: APIKEY" -H "Content-Type: application/json-patch+json" -d "{ \"group_id\": 262, \"email\": \"[email protected]\",}"

Copying the content to the group

For this, you need a board id that you can get from Claned. Depending on the course customer bought, it should reflect the id that is used here.

For this you also need the user ID that will be added as the board admin. This is found in Claned and should be the one who will be administrating the course. If the id is always same it can be used in all requests without changes.

Example payload:

{

"name": "Introduction to Learning Analytics",

"owner_id": 1585,

"co_admin_ids": [

1585

],

"group_ids": [

262

]

}

Example cURL:

curl -X PUT "https://api.claned.com/external/v1/Boards/6715/copy" -H "accept: text/plain" -H "Authorization: APIKEY" -H "Content-Type: application/json-patch+json" -d "{\"name\":\"Introduction to Learning Analytics\",\"owner_id\":1585,\"co_admin_ids\":[1585],\"group_ids\":[262]}"

After this you should have:

  • A user created

  • A group created

  • Content shared to the group

  • User added to the group

Information that should come from the ecommerce platform

  • Email and username (should be the same)

  • Name of user (first name, last name)

  • The product they are buying (this will be the board that is copied to the group)

Did this answer your question?