[New APIs] Get all the updated records from an object type

SOLVE
hari0
Participant

I am working on an integration application that uses HubSpot along with other data to provide AI-based suggestions and pain points to the customer.

 

We need to fetch and sync the HubSpot data periodically for this.

 

I am using the LIST GET API to fetch all the data from an object

/crm/v3/objects/companies/5803412850/associations/contacts?hapikey=

 

And using the SEARCH POST API to periodically sync the data. Based on the `lastmodifieddate` property.

 

crm/v3/objects/contacts/search?hapikey=

{
    "filterGroups": [
        {
            "filters": [
                {
                    "operator": "GT",
                    "propertyName": "lastmodifieddate",
                    "value": "1617630924000"
                }
            ]
        }
    ]
}

 

But this field doesn't exist for all the object types, Eg: It doesn't exist for Companies object type.

 

Is there any way to search the data based on the `updatedAt` field from the records?  As this seems to be a field present for all object records.

There is also the `hs_lastmodifieddate` field. But it mentions that this field will also be updated when HubSpot changes some internal fields. So this would not be the best choice.

0 Upvotes
2 Accepted solutions

Accepted Solutions
webdew
Solution
Top Contributor | Diamond Partner

Hi @hari0 ,

Have you tried this below api?

Link : https://legacydocs.hubspot.com/docs/methods/contacts/get_recently_updated_contacts

URL : https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent?hapikey=demo&count=2

Use above url and when you will get updated contact result then filter in array.

Hope this helps!

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

Thanks and Regards.

View solution in original post

dennisedson
Solution
Community Manager

@hari0 , the legacy APIs are fully supported unless marked as deprecated.  You should not worry about the support 😀

Thanks,

Dennis



Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content

View solution in original post

0 Upvotes
9 Replies 9
dennisedson
Community Manager

Hey @hari0 !

On the surface, this seems like a good use case for webhooks so you can subscribe to changes rather than having to periodically do a dump.

@RMones , @RBThomas might have better advice than I can offer (they usually do 😉)

Thanks,

Dennis



Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
hari0
Participant

Hi @dennisedson 

 

Thanks for the reply

 

I was hoping to avoid the use of webhooks. Currently we are interested in all the properties we can get from the objects. So using webhooks can lead the architecture being too chatty

0 Upvotes
RBThomas
Top Contributor | Diamond Partner

I would still do a periodic "get all" request, but yes webhooks looking for specific property changes may suit you without know more about your integration.

 

Hope that helps!

hari0
Participant

Hi @RBThomas ,

 

Thanks for the reply.

 

We are interested in all the properties for Contacts and Companies objects. So using Webhooks can easily lead to a lot of requests to our backend.

Periodic sync using the Search API ensures that we get only the data that we want (Updated/Deleted data) when we want it.

 

I guess we can use `hs_lastmodifieddate` and search based on the required timestamp

webdew
Solution
Top Contributor | Diamond Partner

Hi @hari0 ,

Have you tried this below api?

Link : https://legacydocs.hubspot.com/docs/methods/contacts/get_recently_updated_contacts

URL : https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent?hapikey=demo&count=2

Use above url and when you will get updated contact result then filter in array.

Hope this helps!

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

Thanks and Regards.

View solution in original post

hari0
Participant

Hi @webdew ,

 

I had seen the `recently_updated` API. But it's from the legacy API list. Is there a new API added which matches this legacy API?

 

0 Upvotes
dennisedson
Solution
Community Manager

@hari0 , the legacy APIs are fully supported unless marked as deprecated.  You should not worry about the support 😀

Thanks,

Dennis



Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content

View solution in original post

0 Upvotes
hari0
Participant

Hi @dennisedson ,

 

Thanks for the reply.

 

Great, Then i can use the `recently_updated` API

0 Upvotes
webdew
Top Contributor | Diamond Partner

No @hari0 this is the only API.

0 Upvotes