SAP Knowledge Base Article - Public

3286759 - How to delete a record using the upsert operation and set this property to DELIMIT/DELETE via Odata API

Symptom

How to delete a record using the upsert operation and set this property to DELIMIT via the Odata API

"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

  • PerEmergencyContacts/PerAddressDEFLT Odata API entity

Resolution

The following explanation can be found in the Help Portal, but it does not contain a specific payload:

PropertyDescription
operationTo delete a record, use the upsert operation and set this property to DELIMIT.

Will use "PerEmergencyContacts/PerAddressDEFLT Odata API entity" as example to explain:

#1.

Post: https://apisalesdemo8.successfactors.com/odata/v2/upsert?$format=json
Payload:
{
    "__metadata": {
        "uri": "PerAddressDEFLT(addressType='mailing',personIdExternal='108743',startDate=datetime'2022-12-14T00:00:00')",
        "type": "SFOData.PerAddressDEFLT"
    },
    "personIdExternal": "108743",
    "addressType": "mailing",
    "startDate": "/Date(1670976000000)/",
    "country": "CHN",
    "operation": "DELIMIT"
}
Response:
{
    "d": [
        {
            "key": "PerAddressDEFLT/addressType=mailing,PerAddressDEFLT/personIdExternal=108743,PerAddressDEFLT/startDate=2022-12-14T00:00:00.000-05:00",
            "status": "OK",
            "editStatus": "UPSERTED",
            "message": null,
            "index": 0,
            "httpCode": 200,
            "inlineResults": null
        }
    ]
}

#2. 

Post: https://apisalesdemo8.successfactors.com/odata/v2/upsert?$format=json
Payload:
{
    "__metadata": {
        "uri": "PerEmergencyContacts(name='Sun1',personIdExternal='tadmin',relationship='5461')",
        "type": "SFOData.PerEmergencyContacts"
    },
    "personIdExternal": "tadmin",
    "name": "Sun1",
    "relationship": "5461",
    "operation": "DELETE"
}
Response:
{
    "d": [
        {
            "key": "PerEmergencyContacts/name=Sun1,PerEmergencyContacts/personIdExternal=tadmin,PerEmergencyContacts/relationship=5461",
            "status": "OK",
            "editStatus": "UPSERTED",
            "message": null,
            "index": 0,
            "httpCode": 200,
            "inlineResults": null
        }
    ]
}

Keywords

"operation", "DELIMIT", PerEmergencyContacts, PerAddressDEFLT, Delete Record via Odata API , KBA , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , How To

Product

SAP SuccessFactors HCM Core all versions