cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get Items or courses using API

0 Kudos
3,190

Good day,

I am wondering if it is possible to extract/get courses from SF LMS using API. I know we currently don't have an API for creating courses but is there an API for getting all the courses in SF LMS using API?

Best Regards,

Helmon.

Accepted Solutions (0)

Answers (1)

Answers (1)

karenperez
Product and Topic Expert
Product and Topic Expert

Hi Helmon,

Yes, it is possible to read course data using the API. One example would be using the sample code below (it will vary depending on your requirement, course type, domain, etc):

GET /learning/odatav4/public/admin/searchItem/v1/Items? $filter=criteria/domainIDs eq 'PUBLIC' and criteria/itemTypeIDs eq 'COURSE' and criteria/active eq true

For all detailed information on how to call this data using the APIs, please refer to the SAP SuccessFactors HXM Suite OData API: Reference Guide, Learning chapter (pag.678).

Thank you.

Best Regards,

Karen Perez

0 Kudos

Hi Karen,

Thank you very much for this it is of great help.

Does this return all the items meeting the criteria or just the first 10 records, I am using postman I can only see 10 records is there as way to see all records.

One last I see it only return these fields below I guess this are the only fields available.

"itemID": "100002",

"itemTypeID": "COURSE",

"revisionDate": 1478867096000,

"itemTitle": "",

"classificationID": "TIME-BASED",

"sourceID": "",

"deliveryMethodID": "",

"domainID": "PUBLIC",

"active": true,

"criteria": null,

"totalCount": null

gerald_reinhard
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

To see more than 10 records you have to make use of paging. Paging is used to avoid that more data is being returned than the http request can manage (size or time wise). To make use of paging you have to specifiy which page you want to read. By default the first page with 10 records are returned. You use $TOP and $SKIP to define the offset ($SKIP) and the amount of records ($TOP). In a UI you usually have a maximum number of results you can display and when the user scrolls or clicks on a next page button you load the next results. If the number of records is 20 the first call would be

GET /learning/odatav4/public/admin/searchItem/v1/Items? $filter=criteria/domainIDs eq 'PUBLIC' and criteria/itemTypeIDs eq 'COURSE' and criteria/active eq true &$top=20

The 2nd call in that case has to be:

GET /learning/odatav4/public/admin/searchItem/v1/Items? $filter=criteria/domainIDs eq 'PUBLIC' and criteria/itemTypeIDs eq 'COURSE' and criteria/active eq true&$SKIP=20&$top=20

and so on.

Also note, that the learning APIs come with some throttling: Throttling Limits for Learning OData APIs - SAP Help Portal

E.g. per user and system a limit of 1-2 API call per second. This means API calls are failing if being called more often than once per second and user. In case of paging this means either you load more data (4 pages, i.e. top=80) to mitigate the risk that users are clicking faster than 2 times per second or you implement a delay in the UI which avoids the overload.

Best regards

Gerald

snehashah
Explorer
0 Kudos

Hi karenperez ,

With reference to your link -- please refer to the SAP SuccessFactors HXM Suite OData API: Reference Guide, Learning chapter (pag.678).
This is no more available, can you share the updated link for available SF-LMS OData Services?
Or if you could confirm this is the latest link?--> https://help.sap.com/doc/cd753f29622244df98e335af737b5422/1908/en-US/SF_LRN_Web_Svc_Integ.pdf

karenperez
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear sneha.hemang.shah,

Follow the link as per request: https://help.sap.com/doc/74597e67f54d4f448252bad4c2b601c9/latest/en-US/SF_HCM_OData_API_REF_en.pdf

Let me know if you still cannot access it.

Thank you.

Best Regards,

Karen Perez