APIs & Integrations

BMehta7
Member

How to fetch Delivered Events data using API

I am trying to fetch delivered events from the web analytics api using the following code in python:

import hubspot
from pprint import pprint
from hubspot.events import ApiException

client = hubspot.Client.create(api_key="myapikey")

try:
api_response = client.events.events_api.get_page(event_type="DELIVERED")
pprint(api_response)
except ApiException as e:
print("Exception when calling events_api->get_page: %s\n" % e)

 But I keep getting this error:
HTTP response body: {"status":"error","message":"Unable to infer object type from: DELIVERED","correlationId":"9266c603-068a-4762-8a63-6fe62d7bca59"}

What should I pass in the event_type parameter so that the api returns all the delivered events data in hubspot?

I could not find a list of valid event types in the latest documentation - https://developers.hubspot.com/docs/api/events/web-analytics  

0 Upvotes
dennisedson
Community Manager
Community Manager

How to fetch Delivered Events data using API

@BMehta7 

Looks like you are missing the object type altogether.

According to the docs, you will need a combination of the object type and either the objectID or the object property

api_response = client.events.events_api.get_page(object_type="contact", object_id=7965346, event_type="delivered")
Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes