APIs & Integrations

CRedmon
Participant

Update companies V3

SOLVE

Hello,

 

I have recently noticed that when you try to update a "single line text" property with "null", it will not clear the property. Is this intended? Currently the way to reset the property would be doing the following:

{
    "properties": {
        "subscription": ""
    }
}



Example:

Url: https://api.hubapi.com/crm/v3/objects/companies/xxx?hapikey=xxx

Payload:

{
    "properties": {
        "subscription": null
    }
}

Expected: The property "subscription" is set to an empty property


1 Accepted solution
FelipeFelix
Solution
Top Contributor

Update companies V3

SOLVE

Hi @CRedmon!

Yes, that is exactly how HubSpot's API works. When you want to clear some property you should define as a blank value, like this: ""

 

Best,
Felipe Felix

View solution in original post

2 Replies 2
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Update companies V3

SOLVE

Hi @CRedmon ,

You can use below code for update empty property :
$data = '{
"properties": {
"subscription": ""
}
}';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.hubapi.com/crm/v3/objects/companies/?hapikey=YOUR_HUBSPOT_API_KEY');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);


Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards. 

FelipeFelix
Solution
Top Contributor

Update companies V3

SOLVE

Hi @CRedmon!

Yes, that is exactly how HubSpot's API works. When you want to clear some property you should define as a blank value, like this: ""

 

Best,
Felipe Felix