SAP Knowledge Base Article - Public

3307746 - While performing UPSERT operation on User entity where NO_MANAGER value is passed in userId field, API server throws httpCode 500 error and asks to add required properties in payload.

Symptom

While performing UPSERT operation on User entity where NO_MANAGER value is passed in userId field, system captures following error in API response.

ERROR: Please add required properties in payload. Required properties department, firstName, status, timeZone, gender, email, username are missing. You can check which properties are required for an entity in Admin Center > OData API Data Dictionary or the entity metadata. with the index 0

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

* OData API

Reproducing the Issue

API Request payload

POST https://apisalesdemo2.successfactors.eu/odata/v2/upsert

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
      xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
      xml:base="https://apisalesdemo2.successfactors.eu/odata/v2/">
    <id>https://apisalesdemo2.successfactors.eu/odata/v2/User</id>
    <title type="text">User</title>
    <updated>2023-02-27T09:33:14.888+03:00</updated>
    <author>
        <name/>
    </author>
    <link href="User"
          rel="self"
          title="User"/>
    <entry>
        <id>https://apisalesdemo2.successfactors.eu/odata/v2/User('sfadmin')</id>
        <title type="text">User</title>
        <updated>2023-02-27T09:33:14.888+03:00</updated>
        <category term="SFOData.User"
                  scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
        <link href="User('sfadmin')"
              rel="edit"
              title="User"/>
        <link href="User('sfadmin')/manager"
              rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/manager"
              title="manager"
              type="application/atom+xml;type=entry">
            <m:inline>
                <entry xml:base="https://apisalesdemo2.successfactors.eu/odata/v2/">
                    <id>https://apisalesdemo2.successfactors.eu/odata/v2/User('NO_MANAGER')</id>
                    <title type="text">User</title>
                    <updated>2023-02-27T09:33:14.888+03:00</updated>
                    <category term="SFOData.User"
                              scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
                    <link href="User('NO_MANAGER')"
                          rel="edit"
                          title="User"/>
                    <content type="application/xml">
                        <m:properties>
                            <d:userId>NO_MANAGER</d:userId>
                        </m:properties>
                    </content>
                </entry>
            </m:inline>
        </link>
        <content type="application/xml">
            <m:properties>
                .
                .
                .
            </m:properties>
        </content>
    </entry>
</feed>


API Response Payload

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
      xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
    <entry>
        <content type="application/xml">
            <m:properties>
                <d:key>User/userId=sfadmin</d:key>
                <d:status>ERROR</d:status>
                <d:editStatus m:null="true"/>
                <d:message m:null="true"/>
                <d:index m:type="Edm.Int32">0</d:index>
                <d:httpCode m:type="Edm.Int32">500</d:httpCode>
                <d:inlineResults m:type="Bag(SFOData.UpsertResult)">
                    <d:element>
                        <d:inlineProperty>manager</d:inlineProperty>
                        <d:results m:type="Bag(SFOData.UpsertResult)">
                            <d:element>
                                <d:key m:null="true"/>
                                <d:status>ERROR</d:status>
                                <d:editStatus m:null="true"/>
                                <d:message>Please add required properties in payload. Required properties department, firstName, status, timeZone, gender, email, username are missing. You can check which properties are required for an entity in Admin Center &gt; OData API Data Dictionary or the entity metadata. with the index 0</d:message>
                                <d:index m:type="Edm.Int32">0</d:index>
                                <d:httpCode m:type="Edm.Int32">500</d:httpCode>
                                <d:inlineResults m:type="Bag(SFOData.UpsertResult)"/>
                            </d:element>
                        </d:results>
                    </d:element>
                </d:inlineResults>
            </m:properties>
        </content>
    </entry>
</feed>

Cause

The OData/upsert does not support inline upsert to set user’s manager to NO_MANAGER.

The highlighted part of the code is inline.

<link href="User('sfadmin')/manager"
              rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/manager"
              title="manager"
              type="application/atom+xml;type=entry">
            <m:inline>
                <entry xml:base="https://apisalesdemo2.successfactors.eu/odata/v2/">
                    <id>https://apisalesdemo2.successfactors.eu/odata/v2/User('NO_MANAGER')</id>
                    <title type="text">User</title>
                    <updated>2023-02-27T09:33:14.888+03:00</updated>
                    <category term="SFOData.User"
                              scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
                    <link href="User('NO_MANAGER')"
                          rel="edit"
                          title="User"/>
                    <content type="application/xml">
                        <m:properties>
                            <d:userId>NO_MANAGER</d:userId>
                        </m:properties>
                    </content>
                </entry>
            </m:inline>
        </link>

Resolution

To update user's manager to NO_MANAGER use the below code in request payload. Basically the highlighted code in Cause section will be replaced by below code.

<link href="User('sfadmin')/manager"
              rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/manager"
              type="application/atom+xml;type=entry" title="manager" href="User('NO_MANAGER')"/>

Keywords

OData, inline, upsert, NO_MANAGER, API, 500, error, httpCode, server, required, properties, payload, , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem

Product

SAP SuccessFactors HXM Suite 2211