Clear a field using REST API

Hello everyone,
how do I clear a field in the contact using the REST API?
In my particular case is the birthday field.
I tried sending null, zero, empty string but the date stay there.
I do a PATCH to /contacts/$id using {“birthday”:xxxxx} as body, where I changed xxxxx to anything I needed.
To populate the field I used the string formatted yyyy-mm-dd and it worked fine, but I have accidentally sent to some of my contacts the value 0000-00-00, which translated somewhat to 0002-11-29 in the web form (I don’t know why), and I want to clear this field without deleting the contact.
Thank you

I just tested that you can perform that operation via the v2/contacts API correctly as follows:

GET https://api.infusionsoft.com/crm/rest/v2/contacts/24?fields=birth_date
Response:

{
    "id": "24",
    "given_name": "FS-16532",
    "family_name": "",
    "birth_date": null
}

PATCH https://api.infusionsoft.com/crm/rest/v2/contacts/24?update_mask=birth_date&fields=birth_date
Request:

{
    "birth_date": "1999-01-01"
}

Response:

{
    "birth_date": "1999-01-01"
}

GET https://api.infusionsoft.com/crm/rest/v2/contacts/24?fields=birth_date
Response:

{
    "id": "24",
    "given_name": "FS-16532",
    "family_name": "",
    "birth_date": "1999-01-01"
}

PATCH https://api.infusionsoft.com/crm/rest/v2/contacts/24?update_mask=birth_date&fields=birth_date
Request:

{
    "birth_date": null
}

Response:

{
    "id": "24",
    "given_name": "FS-16532",
    "family_name": "",
    "birth_date": null
}

So the bug is only on the v1 API. :anguished:

Edit: I just tried and have the same outcome with the v2 API, here’s my logging (I added 1s sleep between calls), and I can confirm in the web UI that the birth_date is the same as birthday in the v1 API and the additional info tab contains the BIrthday field with the value that isn’t cleared.

[04/03/2022 12:13:34] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:8(switchApiVersion) switchApiVersion(2) =>  https://api.infusionsoft.com/crm/rest/v2 
[04/03/2022 12:13:34] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:9(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:35] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:9(get) 200  {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":null} 
[04/03/2022 12:13:36] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:13(patch) PATCH /contacts/44229 {"birth_date":"2000-01-01"} 
[04/03/2022 12:13:37] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:13(patch) 200  {"id":"44229","given_name":"Kekux","family_name":"Test"} 
[04/03/2022 12:13:38] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:15(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:38] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:15(get) 200  {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":"2000-01-01"} 
[04/03/2022 12:13:39] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:19(patch) PATCH /contacts/44229 {"birth_date":null} 
[04/03/2022 12:13:40] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:19(patch) 200  {"id":"44229","given_name":"Kekux","family_name":"Test"} 
[04/03/2022 12:13:41] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:21(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:42] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:21(get) 200  {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":"2000-01-01"}

Reposting since the forum ate my edit :smile:

It isn’t working on my side on the v2 API too.

Below my logging, with 1s pause between API calls.

[04/03/2022 12:13:34] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:8(switchApiVersion) switchApiVersion(2) =>  https://api.infusionsoft.com/crm/rest/v2 
[04/03/2022 12:13:34] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:9(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:35] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:9(get) 200  {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":null} 
[04/03/2022 12:13:36] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:13(patch) PATCH /contacts/44229 {"birth_date":"2000-01-01"} 
[04/03/2022 12:13:37] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:13(patch) 200  {"id":"44229","given_name":"Kekux","family_name":"Test"} 
[04/03/2022 12:13:38] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:15(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:38] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:15(get) 200  {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":"2000-01-01"} 
[04/03/2022 12:13:39] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:19(patch) PATCH /contacts/44229 {"birth_date":null} 
[04/03/2022 12:13:40] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:19(patch) 200  {"id":"44229","given_name":"Kekux","family_name":"Test"} 
[04/03/2022 12:13:41] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:21(get) GET /contacts/44229?fields=birth_date 
[04/03/2022 12:13:42] /var/www/gestionale/ws/infusionsoft/TestSendBirthday.php:21(get) 200  {"id":"44229","given_name":"Kekux","family_name":"Test","birth_date":"2000-01-01"} 

If you set an update_mask with the request it should work; it is required to set values to null.