Symptom
As per the SAP SuccessFactors HCM Suite OData API Reference Guide: section: 13.4.4 Search Filter and Operator Support. It is mentioned that SuccessFactors web services extend support for contains with an and operator. But the API call fails and it has contains and AND operator.
Environment
SAP SuccessFactors Learning
Reproducing the Issue
Use the following API Call and filters:
Micro-service: userlearning-service
API Call: GET https://customer_url/learning/odatav4/public/user/userlearning-service/v1/LearningHistories?$filter=contains(criteria/itemID,'item_ID')and criteria/targetUserID eq 'user_ID'
Error message is returned: "Operator used in each filter expression must be 'eq' "
Cause
The API /learning/odatav4/public/user/userlearning-service/v1/LearningHistories does not support "contains" operator
Resolution
As per our Engineering Team, the API /learning/odatav4/public/user/userlearning-service/v1/LearningHistories does not support contains operator. Though, the framework supports all operators but this entity supports only equal operator. Adding additional operators support would be an enhancement to the API.
In addition according to our Product Management Team "This API can not be used to extract data based on course. This API should be used only for end-user interactions on a portal, in order to retrieve learning history for a specific student. This is why when you pass a specific userID, you get the list of courses that the student has completed. This is working as expected."
You may continue to use the API Call however it can only retrieve the list of Learning Items filtered by the targetUserID.
Another option is to submit an enhancement request to put additional supported operators like "contains" for the said API Call. To submit an enhancement request you may follow this KBA 2090228
Keywords
LMS API microservice, userlearning-service,LearningHistories,contains operator, and operator, supported operator on API , KBA , LOD-SF-LMS-ODA , Web Services OData , Problem