API request

Highlighted
New Contributor

Hi Team,

 

I am working on an ELT tool, using APIs I would like to know how can i make sure that I get only updated data(new data) in second time API call, something like offset we use for single API call to get all the data, as per the reference doc this Offset is not long live.  Or is there a fixed time interval before which I can use the offset from first call and make the  second request 

Reply
0 Upvotes
3 Replies 3
Community Manager

Hey @yellalingh ,

 

The offsets provided accross all of our paginated APIs are not long-lived; while the exact lifespan can differ depending on the API, none of them should be considered valid on a larger timescale than an hour.

 

Depending on what specific data you're pulling from HubSpot, you might consider using some of the recently modified / recently created endpoints (e.g. Recently Created Contacts). While you shouldn't store the offset value, you can store the addedAt timestamp for the last contact you've pulled. The next time you go to pull recently created contacts, you can stop once you've paged back far enough to reach addedAt values that you've already seen.

Reply
0 Upvotes
New Contributor

Hi @Derek_Gervais ,

I am trying to use Create timestamp to pull data, can I don't see any difference in the result. below is the sample url.

https://api.hubapi.com/email/public/v1/events?hapikey=*****&recipient=c****@gmail.com&created=1571241870660

I tried using this object too

{{'$and': [{'recipient': 'c**********@gmail.com'},{'created': {'$gt': 1571241870660}}]}}"

  In both the cases i don't see any change. can you please help me understand if i am missing anything

Reply
0 Upvotes
Community Manager

Hey @yellalingh ,

 

I see; thanks for including an example! The email events API doesn't support a `created` parameter: Instead, you can use a combination of `startTimestamp` and `endTimestamp` to define the timeframe for which you want to pull data, and then paginate through the data using the `offset` values provided in each response.

 

For more details on this method, check out the following endpoint doc: https://developers.hubspot.com/docs/methods/email/get_events

Reply
0 Upvotes