cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve Employee data using Compound Employee API

0 Kudos
3,301

Hi, experts.

I want to retrieve Employee data using Compound Employee API but it's not worked.

I've read the SAP document of Employee Central Compound Employee API, then I send API call as written in the document.

However the response was not what I expected.

If you have any ideas to resolve this issue, plz let me know.

Any answer would be helped.

Thank you.

The request was like this;

<query>
 <queryString>
 SELECT person, personal_information, employment_information,
job_information
 FROM CompoundEmployee
 WHERE last_modified_date >= to_date('2022-01-01','YYYY-MM-DD')
 </queryString>
 <param>
 <name>maxRows</name>
 <value>50</value>
 </paramY
</query>
The response was like this;
[
  {
    "wsdl:definitions": {
      "wsdl:types": {
        "schema": [
          {
            "complexType": {
              "sequence": {
                "element": [
                  {
                    "@name": "errorCode",
                    "@type": "xsd:string"
                  },
                  {
                    "@name": "errorMessage",
                    "@type": "xsd:string"
                  }
                ]
              },
              "@name": "SFWebServiceFaultException"
            },
            "element": {
              "@name": "SFWebServiceFault",
              "@type": "fns:SFWebServiceFaultException"
            },
            "@elementFormDefault": "qualified",
            "@targetNamespace": "urn:fault.sfapi.successfactors.com"
          },
          {
            "import": {
              "@namespace": "urn:fault.sfapi.successfactors.com"
            },
            "simpleType": [
              {
                "restriction": {
                  "enumeration": [
                    {
                      "@value": "insert"
                    },
                    {
                      "@value": "update"
                    },
                    {
                      "@value": "upsert"
                    },
                    {
                      "@value": "delete"
                    },
                    {
                      "@value": "query"
                    },
                    {
                      "@value": "queryMore"
                    }
                  ],
                  "@base": "xsd:string"
                },
                "@name": "featureType"
              },
              {
                "restriction": {
                  "enumeration": [
                    {
                      "@value": "string"
                    },
                    {
                      "@value": "date"
                    },
                    {
                      "@value": "datetime"
                    },
                    {
                      "@value": "int"
                    },
                    {
                      "@value": "long"
                    },
                    {
                      "@value": "float"
                    },
                    {
                      "@value": "double"
                    },
                    {
                      "@value": "boolean"
                    },
                    {
                      "@value": "binary"
                    }
                  ],
                  "@base": "xsd:string"
                },
                "@name": "dataType"
              }
            ],
            "complexType": [
              {
                "sequence": {
                  "element": [
                    {
                      "@name": "companyId",
                      "@type": "xsd:string"
                    },
                    {
                      "@name": "username",
                      "@type": "xsd:string"
                    },
                    {
                      "@name": "password",
                      "@type": "xsd:string"
                    },
                    {
                      "@name": "developerKey",
                      "@type": "xsd:string",
                      "@minOccurs": 0,
                      "@maxOccurs": 1
                    }
                  ]
                },
                "@name": "SFCredential"
              },

Accepted Solutions (0)

Answers (4)

Answers (4)

cesar_contreras65
Discoverer
0 Kudos

Hey, i was in the same issue, solved with this SOAP request:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sfobject.sfapi.successfactors.com">
<soapenv:Header/>
<soapenv:Body>
<urn:query>
<urn:queryString><![CDATA[SELECT person,identity_information,personal_information,address_information,phone_information,email_information,person_relation,employment_information,job_information,job_relation,national_id_card,dependent_information,personal_documents_information FROM CompoundEmployee WHERE LAST_MODIFIED_ON > to_datetime('2024-06-01T00:00:00Z')]]></urn:queryString>
<!--Zero or more repetitions:-->
<urn:param>
<urn:name>maxRows</urn:name>
<urn:value>${property.lv_maxRows}</urn:value>
</urn:param>
<urn:param>
<urn:name>query mode</urn:name>
<urn:value>delta</urn:value>
</urn:param>
</urn:query>
</soapenv:Body>
</soapenv:Envelope>

and, yes, you must get a session id before:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sfobject.sfapi.successfactors.com">
<soapenv:Header/>
<soapenv:Body>
<urn:login>
<urn:credential>
<urn:companyId>${property.lv_SFEC_Company}</urn:companyId>
<urn:username>${property.lvUsername}</urn:username>
<urn:password>${property.lvPassword}</urn:password>
</urn:credential>
<!--Zero or more repetitions:-->
</urn:login>
</soapenv:Body>
</soapenv:Envelope>

 

Regards 

0 Kudos

Hi, jasperdegroot

I send login request to SFAPI, but API response the error.

The request I send like this

POST<https://apixx.successfactors.com/sfapi/v1/soap><http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn: sfobject.sfapi.successfactors.com">
<soapenv:Header/>
<soapenv:Body>
<urn:login>
<urn:credential>
<urn:companyId>COMPANY_ID</urn:companyId>
<urn:username>User_Name</urn:username>
<urn:password>Password</urn:password>
<!--Optional:-->
<urn:developerKey>?</urn:developerKey>
</urn:credential>
<!--Zero or more repetitions:-->
<urn:param>
<urn:name>?</urn:name>
<urn:value>?</urn:value>
</urn:param>
</urn:login>
</soapenv:Body>
</soapenv:Envelope>

and the error message is here

{
    "errorCode": "2108",
    "message": "{\"fault\":{\"faultstring\":\"Failed to execute the ExtractVariables: ExtractCompanyId\",\"detail\":{\"errorcode\":\"steps.extractvariables.ExecutionFailed\"}}}",
    "failureType": "UserError",
    "target": "Web2",
    "details": []
}

I was able to log in on the website.

Waeltken
Explorer
0 Kudos

jasper.de.groot - we are running into the same error trying to perform a login process. Same error message related to companyId and ours is definitely noted correctly. Is this error code really specific to the attribute or are there other sources of error to troubleshoot? Working in Postman for now.

Regards,

Henrik

nlgro023
Active Contributor
0 Kudos

Sure, you have to use the login tab, that should create a request like this (you need to replace the capitalized words with details from your SuccessFactors system (the link could look something like this: https://api55preview.sapsf.eu/sfapi/v1/soap) :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sfobject.sfapi.successfactors.com">

<soapenv:Header/>

<soapenv:Body>

<urn:login>

<urn:credential>

<urn:companyId>NAME</urn:companyId>

<urn:username>USER</urn:username>

<urn:password>PASSWORD</urn:password>

<!--Optional:-->

<urn:developerKey>?</urn:developerKey>

</urn:credential>

<!--Zero or more repetitions:-->

<urn:param>

<urn:name>?</urn:name>

<urn:value>?</urn:value>

</urn:param>

</urn:login>

</soapenv:Body>

</soapenv:Envelope>

Please have a look at this blog too: Connecting Successfactors APIs Using SOAP UI | SAP Blogs

0 Kudos

Thank you your kind reply.

I'm busy today, so I'll try it tomorrow or next Monday.

Then l'll tell you whether a query is worked.

Thank you.

nlgro023
Active Contributor
0 Kudos

It looks like that it can't understand what you request due to the format.

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

<urn:query xmlns:urn="urn:sfobject.sfapi.successfactors.com">

<urn:queryString>

SELECT person, personal_information employment_information, job_information

FROM CompoundEmployee WHERE

last_modified_on > to_datetime('2022-01-01T01:00:00Z')

</urn:queryString>

<urn:param>

<urn:name>queryMode</urn:name>

<urn:value>delta</urn:value>

</urn:param>

<urn:param>

<urn:name>resultOptions</urn:name>

<urn:value>configuredFieldsOnly,renderPreviousTags</urn:value>

</urn:param>

</urn:query>

</soap:Body>

</soap:Envelope>

If you use SOAP UI, don't forget that you must first do the logon request to get the JSESSIONID, which is a hard requirement in the header to do the call.

0 Kudos

Hi, jasper.de.groot

Thank you for your answer.

I am just a IT beginner and don't speak English very well, so SOAP API is too difficult for me.

I have a question for you.

I'm now using SOAP UI(Azure Synapse Analytics) so, as you said, I have to get the JSESSIONID.

However I have no idea how to get it. Could you tell me a sample code please?

Thank you.