SAP Knowledge Base Article - Public

2268713 - LMS OData API Error when searching by courseCategory

Symptom

The following error is returned when searching the catalog by courseCategory:

{"error":{"code":null,"message":"while trying to invoke the method com.plateausystems.elms.client.javabean.StudentJB.getCurrentStudentID() of an object loaded from local variable 'studentJB'********"}}

Environment

SAP SuccessFactors Learning

SAP SuccessFactors HXM Suite

Reproducing the Issue

1. First you will need to get the token, a sample url is below

https://{destinationHost}/learning/oauth-api/rest/v1/token

Provide the appropriate json formatted properties in the authorization request as in the below example

{
   "grant_type":"client_credentials",
   "scope":{
      "userId":"adminSF",
      "companyId":"DEFAULT",
      "userType":"admin",
      "resourceType":"learning_public_api"
} }

2. Provide an endpoint of the below

https://{endpoint_url}/learning/odatav4/catalogSearch/v1/CatalogItems?$filter=criteria/courseCategory%20eq%20%27{provideItemTypeHere}%27

3. As in the above url provide the related destination host and item type in the filter. For example 'Online' or 'Instructor-Led'.

Cause

The error indicates that the backend server is unable to obtain the user information for the request. It must be able to determine the student for the request.

Resolution

In the original token request for this API call the userType defined was 'admin'. This API must be sent from the perspective of a student and not an admin. Based on that in order for the call to work correctly you must change the userType in the token request from admin to user. See below for the example.

{
   "grant_type":"client_credentials",
   "scope":{
      "userId":"userSF",
      "companyId":"DEFAULT",
      "userType":"user",
      "resourceType":"learning_public_api"
} }

Keywords

StudentJB.getCurrentStudentID, object loaded from local variable, studentJB, userType, , KBA , LOD-SF-LMS-ODA , Web Services OData , Problem

Product

SAP SuccessFactors Learning all versions