Issue in create polling on hubspot apis


#1

Hello ,

Please anyone can help me to sort the issue of how we do polling on hubspot because i have seen that on API guidelines of hubspot and also tested the apis that it has provided , most of the apis cannot contains any ‘param’ that poll either updated or newly created record according to two timestamps .

Thanks & Regards
Sanjay


#2

Hi @sanjay1001

What objects are you trying to poll for? How you poll for new items is going to depend on what objects you’re looking at.

For Contacts, Companies, and Deals, there are specific endpoints that get recently created items. The endpoints start with the most recently created items, and you’d need to page backwards (as details on the documentation pages) till you reach the last time you polled for updates.



Other objects (such as blog posts and other COS content) support filtering by the created property. This request would return all blog posts created this year:
https://api.hubapi.com/content/api/v2/blog-posts?created__gt=1451624400000&hapikey=demo

Keep in mind that most of our endpoints have a limit to the number of items they’ll return in a single response, so you may need to page through the results even with endpoints that support filters.


#3

Hi @dadams,

Thanks for the reply .

Suppose we got all the contacts via hubspot API : https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=demo
and for polling i have fixed the api call at every midnight by the use of API , https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent?hapikey=demo

the let me know , the polled data which we got from 'http://developers.hubspot.com/docs/methods/contacts/get_recently_updated_contacts
1 . Is it contains all contact records including that we saved into first time also ?
2 . Is it contains only those contact records from the last record that we had inserted into DB.
if yes , then OK
and if no , then what parameter shall i pass with API url that we will get only recent record from the last record of DB.

Thanks
Sanjay


#4

Hi,

One More thing i want to ask ,
Can i use this API https://api.hubapi.com/contacts/v1/contact/vid/215913/profile?hapikey=demo&showListMemberships=x&formSubmissionMode=x
as
https://api.hubapi.com/contacts/v1/contact/vid/{$user[‘contact_id’]}/profile?access_token={$token}&showListMemberships=false&formSubmissionMode=none

the only diff is that i have replaced hapikey via access_token

Thanks
Sanjay


#5

Any endpoints will work the same with with either hapikey= or access_token=, so you can use either form of authentication.

The GET /contacts/v1/lists/recently_updated/contacts/recent endpoint returns any contacts updated in the last 30 days, starting with the most recently updated records, and there isn’t a way to limit how far back the endpoint itself will go. If you’re checking for new records at midnight each day, you’d need to page backwards through the contacts until you get a "time-offset" in the response that is before midnight the previous night, at which point you’d have all of the contacts updated in the last 24 hours.

You can find more details for using the recently updated endpoint here:
http://developers.hubspot.com/docs/faq/how-do-i-use-vidoffset-and-timeoffset


#6

Thanks @dadams for your help .