SAP Knowledge Base Article - Public

2558226 - How to make/test the Learning API connection?


How to make/test the Learning API connection?

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.


SAP SuccessFactors Learning

Reproducing the Issue

The user gets a 403 error and does not get the bearer access token for the Learning API.


Often the Client Secret is not correct or has been incorrectly generated.


Steps to confirm the Learning API is working as expected:

1. Get the Client Secret > This is generated in the Learning admin side > System Administration > Configuration > OAuth Token Server > Note: Generating a new Client Secret will invalidate all previously generated ones. Please ensure to note down the newly generated Client Secret. The system does not store the actual value but only the hashed one, so once you leave this page, it will not be possible to recover it >


2) Encode your Client Secret along with the Company ID (it is found in the Learning admin side > OAuth Token Server area) > Feel free to use any option to perform it, e.g.: > Put in the Company ID+:+the Newly Generated Client Secret (sample format: companyID:123abc456def) > Then, encode it and save the output > If you will use the "base64encode" site, when encoding, make sure no box is selected (boxes available above the "Encode" button) >


3) Go to your rest client (if you do not have one, it would be possible to go to the browser's store and install an add-on. In the example below, Firefox and RESTClient are being used) > Settings are as per the screenshot > Method - POST > URL - >


4) From the top of the screen, select "Headers" dropdown > Custom Headers > Name - Authorization > Value - Basic + the saved encode output (sample format: Basic 123abc456def > Click "Okay" >


5) Into the "Body" box, enter the following >





"companyId":"Company ID",





Note: The "userType" value can be either "admin" or "user".


6) Click "SEND" > See the response is 200 OK > At this point, it confirms the API is working and responding >


7) Take the value between the "" in the "Response Body (Raw)" tab >


8) Open a new rest client > Method - GET > URL - > From the top of the screen, select "Headers" dropdown > Custom Headers > Name - Authorization > Value - Type the "Bearer" word > Put the value from the "Response Body (Raw)" tab that was generated in the previous step >


9) You will need a second header > From the top of the screen, select "Headers" dropdown > Custom Headers > Name - Content-Type > Value - Application/json >



10) Place your code into the body > Below there is an example of a call to get the details on a student.


  "recordLearningEvents": [


      "studentID": "ID",

      "componentTypeID": "ID",

      "componentID": "ID",

      "revisionDate": 946684800000,

      "completionStatusID": "ID",

      "completionDate": 1508853045000,

      "completionTimeZoneID": "Europe/London",

      "revisionNumber": "1",

      "totalHours": 1,

      "instructorName": "instructor",

      "comments": "sample"





See Also

Learning OData API Reference


learning, api, client, secret, bearer, token, rest, generate, encode, oauth-api/rest/v1/token , KBA , LOD-SF-LMS-ODA , Web Services OData , LOD-SF-LMS , Learning Management System , LOD-SF-LMS-ADM , System Admin, Global Variables, References , How To


SAP SuccessFactors Learning all versions