SAP Knowledge Base Article - Public

2365401 - How to Delete Candidates via ODATA API - Recruiting Management

Symptom

How do I delete a candidate using 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 Recruiting Management

Resolution

In order to delete an external candidate from Recruiting Module, we have two options:

The first one is an admin tool that is described on this article: 2670133 - Delete Candidate Feature - Recruiting Management. The second option is through an upsert operation using Odata API. This article will describe this process.

In order to delete a candidate using Odata API, the Data Privacy Consent Statement needs to be enabled and the RCM Entity Anonymization Job needs to be running.

Prerequisites:

  1. The instance needs to use DPCS 2.0 privacy setting. (Provisioning > Edit Candidate Privacy Options > Enable external data privacy agreement set up, and requires acceptance on external candidate registration (requires Version 11 UI framework (ULTRA));
  2. RCM Entity Anonymization Job running on daily basis;

Note: These Prerequisites are necessary because the upsert we will conduct will not delete the candidate profile. It will just mark the candidate to be deleted by the Anonymization Job.

How to Execute the Operation:

Here are the steps that need to be followed to mark the candidate do be deleted.

  1. Identify the candidate you want to delete. Let's use as an example the Candidate ID "1706";
  2. Send the following oData request:
    POST  <server>/odata/v2/upsert

{

"__metadata":{

     "type":"SFOData.Candidate",

        "uri":"Candidate(2702)"

         },

"agreeToPrivacyStatement":"false"

}

You will get this response as confirmation:

{

  "d": [

    {

      "key": null,

      "status": "OK",

      "editStatus": "UPDATED",

      "message": "Candidate has been updated successfully",

      "index": 0,

      "httpCode": 204,

      "inlineResults": null

    }

  ]

}

Note: The agreeToPrivacyStatement value in the Candidate Profile is upsertable, so a candidate can be set to: agreeToPrivacyStatement: false, this has the same effect as deleting a candidate through Admin Centre:  Admin Centre > Delete Candidate;

The Candidate’s anonymization flag is now marked as declined and the profile will be anonymized after the anonymization scheduled job has completed.

How to delete multiple candidates?

Due to a product limitation, this is currently not possible. Even if you create a payload that contains multiple candidates, only the first candidate in the list will be actually updated.

An enhancement is already planned for this topic, your CSM will be able to follow this internal reference: RCM-67283.

At the moment the only alternative to mass update them will be to find a method to repeat several individual Upserts.

See Also

2670133 - Delete Candidate Feature - Recruiting Management

Keywords

delete candidates, oDATA, DPCS 2.0, delete candidates, how to delete multiple candidates, mass candidate deletion, deleting many candidates , KBA , LOD-SF-RCM-API , Webservices & APIs , LOD-SF-RCM , Recruiting Management , How To

Product

SAP SuccessFactors Recruiting all versions