View and download course catalog assets via API

With the Learn365 API, you can view and download the assets from your course catalogs. By course catalog assets, we mean any documents, videos, or images uploaded in the Learn365 Admin Center via the rich text editor at course catalog level, for example, in course catalog or training descriptions. Assets from both the Microsoft SharePoint storage and the Azure Blob Storage are available for viewing and downloading via API.

In this article, we describe the steps you should follow to view and download assets via the Learn365 API.

 

Find an asset name or path

The Learn365 API provides various endpoints that enable you to view and download assets. However, to use any of these, you’ll need the file name or file path of the asset.

To find a file name via API, you’ll need a course catalog ID. You can find this via API by following the steps in this article.

To get a file name or file path:

1. Go to https://api.365.systems/ and make sure you are authorized with the relevant API key.

2. In the CourseCatalogs section, select the GET /odata/v2/CourseCatalogs({Id})/SiteAssetsList() endpoint and select Try it out in the top right-hand corner.

3. In the Id field, enter the course catalog ID.

4. Select Execute to run the request.

5. Go to the Response block to check the results:

  • 200 code with a list of assets in its body indicates a successful response. The list contains all assets for the selected course catalog. Each asset in this list has the FileName and AbsoluteUrl parameters that you’ll need to view or download the asset.

    Asset info

  • In case of an error, the response body contains the error object with the code and message keys explaining the issue.

 

View or download an asset from a course catalog

To view or download an asset from a course catalog:

1. Go to https://api.365.systems/ and make sure you are authorized with the relevant API key.

2. Select one of these endpoints:

  • In the Assets section, select the GET /courseCatalog/SiteAssetByNameAsStream endpoint and select Try it out in the top right-hand corner.
  • In the CourseCatalogs section, select the GET /odata/v2/CourseCatalogs({Id})/SiteAssetByNameAsStream(filename=’{fileName}’) endpoint and select Try it out in the top right-hand corner.

3. In the catalogId or Id field (depending on the endpoint you chose in the step 2), enter the course catalog ID.

4. In the fileName field, enter the file name of an asset. The format might be different depending on the asset storage: the Microsoft SharePoint storage or the Azure Blob Storage.

For assets from the Azure Blob Storage (they have the assetsstorage part in their URL), you can enter:

  • a file name with its extension, for example, 354567161.jpeg.
  • a relative file path, for example, assetsstorage/75454f67-d907-4a43-b0f9-0c9c12277edf/354567161.jpeg.

For assets from the Microsoft SharePoint storage (they have the sharepoint part in their URL), you can enter:

  • a file name with its extension, for example, 354567161.jpeg.
  • a file path relative to SiteAssets, for example, d2d325ea8995467b9bfbb80a41df74f5/354567161.jpeg.
  • an absolute URL, for example, https://test.sharepoint.com/sites/OrientationTraining/SiteAssets/ d2d325ea8995467b9bfbb80a41df74f5/354567161.jpeg.

 

Request for downloading assets

 

5. Select Execute to run the request.

6. Go to the Response block to check the results:

  • 200 code with an asset in its body indicates a successful response.

    Response for downloading assets

  • In case of an error, the response body contains the error object with the code and message keys explaining the issue.

 

Was this article helpful?
0 out of 0 found this helpful

Comments

Article is closed for comments.