Trying to remove email address

Tagged:

Currently contains 11 posts

Avatar

November 20, 2020 23:13

hirenexus

I’m trying to remove an email address but nothing I’m doing has worked. I’m passing the JSON correctly as far as I can tell:

“EmailAddress”:""

I even tried passing it with a space in it but that did not work.

Avatar

November 20, 2020 23:15

hirenexus

I just tried replacing the text and it still doesn’t update the record:

“EmailAddress”:“bad_email_address”,

Avatar

November 20, 2020 23:18

Jarrid-PCRecruiter

I just did this and it worked for me. Are you doing a PUT request? https://www.pcrecruiter.net/rest/api/candidates/107949117964476?SessionId=$yoursessionID

Payload:
{
“EmailAddress”: ""
}

Where your candidate_id replaces 107949117964476?

Avatar

November 25, 2020 18:28

hirenexus

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘PUT’);

Avatar

November 25, 2020 18:28

hirenexus

I’m using PUT

Avatar

November 25, 2020 19:00

Jarrid-PCRecruiter

Did you double check the endpoint your using? Can you clear other fields? My only other thought is the PCR username doesn’t have permission to edit that field (e.g. read-only on edit).

Avatar

November 25, 2020 21:09

hirenexus

public function putData($url,$data)
{
$sessionId = $this→getSessionID();
$url = $url . “?SessionId=”.$sessionId;

$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’, ’Content-Length: ’ . strlen($data))); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘PUT’); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); //consoleLog("response :: " . $response); curl_close($ch); //consoleLog("end :: "); return $response; }

The URL variable is being set to:
https://www.pcrecruiter.net/rest/api/candidates/0000000000 where the zeros are the candidate’s ID

Avatar

November 25, 2020 21:13

hirenexus

I changed the permission for the API user to full system admin and still no luck.

Avatar

November 25, 2020 21:22

Jarrid-PCRecruiter

If you want to send me an email with the credentials used to create the sessionID and the actual requestion you’re passing I can review it on Monday.

Avatar

November 25, 2020 21:37

hirenexus

I’m a dummy. I was passing the wrong array to the function so the data wasn’t in JSON format. Sorry to have bothered you and wasted your time.

Avatar

November 25, 2020 21:44

Jarrid-PCRecruiter

All good!

Reply to thread