Human Capital Management Blogs by Members
Gain valuable knowledge and tips on SAP SuccessFactors and human capital management from member blog posts. Share your HCM insights with a post of your own.
cancel
Showing results for 
Search instead for 
Did you mean: 
FrancoTornaghi1
Participant

During SAP SuccessFactors Time Tracking  implementation is very common to make some test on how an external terminal could work in integration with the time tracking module.One of the easiest ways we have found is through Postman.

Here is a step by step on how to send time events with Postman that is API platform.postman.png1. Go to “Manage OAuth2 Client Applications” transaction.

Imagen1.png2. Then go to “Register Client Application” to create a new OAuth2 client.

A new screen like the below will appear, introduce the following values

Imagen2.png

Application Name: Introduce a label for you to identify this client in the client list
Application URL: https://api2preview.sapsf.eu/rest/timemanagement/timeeventprocessing/v1/TimeEvents

3. Go to Generate X.509 Certificate

A new screen will appear, insert a common Name. Any reference label.

Imagen3.pnga screen like the below will appears:

Imagen4.png

Select: “bind to Users”
Insert the Technical user: TECHNICAL_USER_CICOTERMINAL_9D3F8AC1

 

Ok, why this user?

SfSf has pre-configured users for the OAuth authentication. This was something hard to crack for me, but if you want more info please refer to the following SAP Help

SAP HELP explanation 

Imagen5.png

5. Click Register

6. Copy the X.509 Certificate that you will need during the Postman configuration.Imagen6.png

 

In Postman

At this point, you have already downloaded an installed the Postman software.

A. In collections go to the pus icon and select “blank collection”

Imagen7.png

B. Select Authorization and “OAuth 2.0”

Imagen8.pngC. Into the Authorization tab set as follow.

Imagen9.png

D. In the side panel select the first request.

Imagen10.pngE. In the Headers tab insert:

Method: POST
URL:  https://api2preview.sapsf.eu/oauth/idp
Content-Type : application/x-www-form-urlencoded

Imagen11.pngF. Go to the Body tab and insert the following values:

Client_id : here insert the API Key obtained in "Manage OAuth2 Client Applications"
Company_id: yours
User_id : TECHNICAL_USER_CICOTERMINAL_9D3F8AC1
token_url : https://api2preview.sapsf.eu/oauth/idp
private_key : The on e obtained in the X.509 Certificate in the “Manage OAuth2 Client Applications” SfSf transaction
grant_type : urn:ietf:params:oauth:grant-type:saml2-bearer

Imagen12.png

With these values make a POST call and as a result you Will obtain a Token that Will be used in the next call.

Imagen13.png

G. The next step is to change the service for https://api2preview.sapsf.eu/oauth/token and introduce a new key called “assertion” where is introduced the token of the previous call.

As a result is obtained a token to be used in the OAUTH call. This token spires in 24 hours.

Imagen14.png

 The last step:

I recommend you to copy the request as shown below:

Imagen15.png

 Then in the Headers tab, insert:

Authorization: Bearer “white space” and  the token_oauth
Content-Type: application/json
Accept: application/json

Like below:

Imagen16.png

 And in the Body Tab insert the following sentence

[
   {
      "id": "1",
      "assignmentId": "USERID",
      "typeCode": "P10",
      "timestamp": "2024-01-18T08:00:21+02:00",
      "terminalId": "the string that represents the terminal (no validation for this value)",
      "timeTypeCode": "yours time type code"
   }
]

Imagen17.png

 As a result is obtained a message like below.

Imagen18.png

 Hope this blog helps! 
Special thanks to @daniel_villegas postman and integrations spec!

Labels in this area