Configuring Write Operations in EC OData

Objective

After completing this lesson, you will be able to query SAP SuccessFactors Employee Central data using OData APIs from a test client.

Introduction

The next series of contents will cover the basic Knowledge of how to write data to SuccessFactors.

Writing Data Operations

There are four ways to write data:

POST: odata/v2/cust_MyBuilding

PUT: odata/v2/cust_MyBuilding( effectiveStartDate=datetime → CREATE (UI incl. RBP)

'1990-01-01T00:00:00', externalCode='GRTTESTKM3') → UPDATE (UI incl. RBP)

POST: odata/v2/upsert?purgeType=incremental → UPDATE OR CREATE Integration - no RBP

POST: odata/v2/upsert?purgeType=full → DELETE OR CREATE Integration - no RBP

Sometimes we need to write data to the EC system, for a small amount of data we can achieve it in the SAP SuccessFactors Employee Central, but if a large amount of data is required, it is better to write data in other ways. There are 4 ways to write data which is shown on the page.

Writing Data Payload

Snippet code of Writing data Payload.

From Query to Write

  1. Build a query and execute in Advanced Rest Client
  2. Copy response of query to clipboard (take care that each token has " and after each token there is a comma ) and copy to payload
  3. Change from GET to put or post (an in case of upsert replace entity name by upsert)
  4. add content type to URL http header to indicate the format being used for payload
  5. Execute write API

Use copy to clipboard link in advanced rest client instead CTRL-C in browser.

Use http://www.epochconverter.com/ to convert dates to EPOC timestamp and vice versa

  • e.g. 631152000000 is equal to 1990-01-01T00:00:00 which translates to Mon, 01 Jan 1990 00:00:00 GMT

Not all entities support all write operations:

  • MDF Objects and Platform objects, e.g. User, Position, EmployeeTime, etc. support Entity with POST and PUT as well as upsert.
  • EC Entities such as EmpJob and PerPersonal do support upsert only.
  • EC2MDF Entities such as FODepartment and FOCostCenter support upsert but POST and PUT with some limitations.

Further Features

SAP oData POST request for Cust_MyBuilding resource, sending JSON payload, response status 201 Created, content type application/json.
  • CREATE
  • Creates a new Building 3 and links to Room 1 and 2
  • Format of Payload

Combine Create/Link

POST: odata/v2/cust_MyBuidling

Payload:

{ "effectiveStartDate" : "\/Date(1437436800000)\/",

"externalCode" : "GRTBLD3",

"externalName" : "Gerald Building 3",

"cust_rooms" : [

{

"__metadata" : {

"uri" : "https://salesdemo4.successfactors.com:443/odata/v2/cust_MyRoom(effectiveStartDate=datetime'2015-07-21T00:00:00',externalCode='GRTROOM1')", "type" : "SFOData.cust_MyRoom"

}},

{"__metadata" : {

"uri" : "https://salesdemo4.successfactors.com:443/odata/v2/cust_MyRoom(effectiveStartDate=datetime'2015-07-21T00:00:00',externalCode='GRTROOM2')", "type" : "SFOData.cust_MyRoom"

}}

]

}

Execute Employee Data Queries via REST Client with OData API

Process Overview

This simulation demonstrates the basic configuration steps required to manually set up the configuration for SAP SuccessFactors Employee Central. You will get the basic knowledge of OData API call & Tools. How to monitor the APIs for different partners.

Prerequisites

The following configuration and customization must have been completed before implementing Basic Settings in SAP SuccessFactors.

  • Access to OData SFAPI
  • Access to Audio Log
  • Access to API Tools

Result

As part of this demonstration, we will cover configuration section in EC, which is: EC OData Basics - Query Operations.