SAP Knowledge Base Article - Public

3321602 - OData API: Upserting links / associations using XML format

Symptom

You are trying to upsert a link / association in XML format using the SuccessFactors OData API framework.

 

For example, you are trying to achieve the following JSON association (or similar) but you need to do this via XML:

  • {
      "__metadata": {
          "uri": "User('Employee')"
      },
      "matrixManager": {
          "__metadata": {
              "uri": "User('EmployeesMatrixManager')"
          }
      }
    }

   

When trying to do this, you may be encountering a variety of errors which can change depending upon the structure of your XML request payload.

  

This situation is applicable to almost all entities / objects in which an association can be made, some common examples include:

  • Upserting / associating a user's manager, matrixManager, customManager in the User entity
  • Upserting / associating a position's parentPostion in the Position entity
  • Upserting / associating an attachment record to an existing MDF record in any MDF entity (custom or standard)

      

Environment

  • SAP SuccessFactors HXM Suite
  • OData API

   

Cause

The most common cause of the association not working in XML is due to an incorrect XML payload structure used for the association / link operation.

  

Typically we see customers / partners using the <inline></inline> & creating an additional XML payload structure for the record being associated

  • The API then throws validation errors regarding the record being associated because the system in interpreting this as an inline edit or creation 
  • These could include validation errors related to duplication, required properties missing, inline not supported, etc.

        

Resolution

The correct way to achieve the association / link using XML for the initial use-case shown in the Symptom section, would be like below: 

  

  

We typically provide all use-cases in JSON format as it is a more lightweight format with simpler structures that offers better readability.

XML is a more heavyweight format which tends to have more complex structures which is clearly visible when comparing the above JSON & XML structures

  

Please note:

  • This example is intended for demonstration purposes only
      
  • SAP Cloud Support cannot advise/guide customers or partners on how to convert a JSON use-case to a work in XML to meet their needs
      
  • As stated above, XML is a more heavyweight format / more complex structure & any requests to convert JSON to XML will be considered a consultation request related to implementation of a customer's unique / specific requirements which is out of scope: 2706322

    

See Also

Payload structure for SuccessFactors Upsert in SAP Cloud Integration
https://blogs.sap.com/2019/09/15/payload-structure-for-successfactors-upsert-in-sap-cloud-platform-integration/

    

Keywords

XML, JSON, upsert, link, associate, association,<inline>, manager, matrixManager, customManager, partentPosition, attachmentNav, , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT-API , API & Adhoc API Framework , LOD-SF-INT-CPI , Standard SF to 3rd Party CPI (HCI) Content , LOD-SF-INT-MDF , Metadata Framework API (MDF) , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , How To

Product

SAP SuccessFactors HCM all versions