Skip to Content
avatar image
Former Member

Successfactors: Odata API to create a time off entry for an employee

Hi,

We have a web application which needs to create a time off vacation entry for users in Successfactors. Obviously, we need to use SuccessFactors Odata APIs to do this. We are looking for the specific APIs that we can use to do the following:

1. Query by giving an employee number and get their time off balances

2. Create a time off request for a specific start date and end date and time off type.

Regards

Ravi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • May 26, 2017 at 06:07 PM

    Hi Ravi,

    Check the below entities for your queries.

    1. Query by giving an employee number and get their time off balances

    https://<hostname>/odata/v2/EmpTimeAccountBalance?$filter=userId eq '<userIdValue>' and timeAccountType eq '<timeTypevalue>'

    above service will give you the total leaves for the current year in the property balance.

    https://<hostname>/odata/v2/EmployeeTime?$filter=userId eq '<userIdValue>' and (timeType eq '<timeTypevalue>') and (startDate ge datetime'2017-01-01T00:00:00')

    in response u can find the property deductionQuantity for the timeType. this is a list of records for the current year. sum all the deduction quantity from the response list.


    balances = balance - (sum of deductionQuantity)

    2. Create a time off request for a specific start date and end date and time off type.

    https://<hostname>/odata/v2/EmployeeTime

    Payload:

    { "__metadata" : { "uri" : "http://<hostname>/odata/v2/EmployeeTime", "type": "SFOData.EmployeeTime"}, "startDate": "/Date(1483920000000)/", "endDate": "/Date(1483920000000)/", "externalCode": "<some unique value>", "userIdNav": { "__metadata": { "uri": "https://<hostname>/odata/v2/User('<userId>')", "type": "SFOData.User" }}, "timeTypeNav": { "__metadata": { "uri": "https://<hostname>/odata/v2/TimeType('<timeType>')", "type": "SFOData.TimeType" } } }

    Consider the property externalCode which should be unique value always like key parameter while creating.

    Regards,

    Venu

    Add comment
    10|10000 characters needed characters exceeded

  • May 29, 2017 at 06:09 PM

    also you can get using Integration center also, ie simple querying the data

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 05 at 09:11 AM

    Hi,

    Can I use this Odata EmpTimeAccountBalance to query for multiple userIds and timeAccountType combination? i tried different possibilities and could not get the query to work in CPI.

    Thanks

    Add comment
    10|10000 characters needed characters exceeded