APIs & Integrations

CRedmon
Participante

Update companies V3

resolver

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


0 Me gusta
1 Soluciones aceptada
FelipeFelix
Solución
Colaborador líder

Update companies V3

resolver

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

Ver la solución en mensaje original publicado

0 Me gusta
2 Respuestas 2
webdew
Guía | Partner nivel Diamond
Guía | Partner nivel Diamond

Update companies V3

resolver

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. 

0 Me gusta
FelipeFelix
Solución
Colaborador líder

Update companies V3

resolver

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

0 Me gusta