Hi,
How can I get the recently modified records in my custom object through API?. I found the documentation for contact and deals, but not for the custom objects.
I used this https://api.hubapi.com/crm/v3/objects/, but I couldn’t find the method to order by modified date.
Thanks in advance,
Kale
Hi @kaleperez
I do not believe that exists yet in the v3 endpoints as it does in the v1. You could use the search api and filter by date
Hi @kaleperez ,
Hope this will work :
Please check below code for get the recently modified custom object
$data = ‘{
“sorts”: [
{
“propertyName”: “<updated_date_key>”,
“direction”: “DESCENDING”
}
]
}’;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://api.hubapi.com/crm/v3/objects/\/search?hapikey=YOUR_HUBSPOT_API_KEY’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
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.
Thank you, I really appreciate your help. Perfect Solution.