SAP Knowledge Base Article - Public

2320264 - How to make an SFAPI call

Symptom

  • How to make an SFAPI call?
  • How to ensure that the SFAPI call is successful?
  • This document can be used to confirm if the user has access to SFAPI.

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

Environment

  • SAP SuccessFactors HXM Suite
    • SFAPI

Cause

This is helpful to troubleshoot issues related to API access, HTTP 401 errors or to verify if the user has access has to make API calls.

Resolution

Note: In order to use SFAPI, the API user needs specific permissions to use it. Refer to the KBA "How to enable SFAPI in SuccessFactors" for more information.

In this article, we will use the browser extension Wizdler (this is not an SAP tool/application) to test the SFAPI. However, the same logic presented here for Wizdler should also work for other tools, like SOAP UI or Postman for example.

Once the Wizdler extension is added to the browser, place the wsdl url in the browser and hit enter (append /sfapi/v1/soap?wsdl at the end of the api url to get the wsdl url). You will find the API url of all data centers in the KBA 2215682.

Example: https://api68sales.successfactors.com/sfapi/v1/soap?wsdl

Testing SFAPI with Basic Authentication

  1. Click on the Wizdler icon shown below and select "login"

    wizdler_login.png

  2. Enter the Company id, Username and Password as shown below and hit "Go".

    login_wizdler_body.png

  3. If the call returns a session id, it indicates that the API call is successful and the communication is successful to the API server.

    sessionId_wizdler.png

This sessionId is then used in the subsequent calls (query or Upsert, for example).

Testing SFAPI with OAuth

In order to use OAuth, please generate an access token first (guide page Requesting an Access Token).

With the OAuth token in hand, follow these steps:

  1. Open the "wsdl" URL in the browser and go to "Login" option in Wizdler.
  2. Click in the arrow down (right beside the "Go" button) and enable HTTP headers.

    http_headers.png

  3. In the headers, add one line with the following value
    "Authorization: Bearer <token_value_previously_generated>".

    bearer_wizdler.png

  4. In the body, add the following content:

    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Body>
    <login xmlns="urn:sfobject.sfapi.successfactors.com">
    <credential>
    <companyId></companyId>
    <username></username>
    <password></password>
    <developerKey></developerKey>
    </credential>
    </login>
    </Body>
    </Envelope>

    Note that companyId, username and password tags should be empty. It will look like this:

    wizdler_oauth_body.png

  5. Click on "Go" and the sessionId should be generated:

    wizdler_oauth_response.png

This sessionId is then used in the subsequent calls (query or Upsert, for example).

See Also

2215682 - Successfactors API URLs for different Data Centers

2161909 - How to enable SFAPI in SuccessFactors

Keywords

SF, success factors, SuccessFactors, SFAPI, test, login, call, API, SOAP, connection, connecting, Wizdler, oauth , KBA , LOD-SF-INT , Integrations , LOD-SF-INT-API , API & Adhoc API Framework , How To

Product

SAP SuccessFactors HCM Suite all versions