We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Jan 21, 2022 2:37 PM
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
Jan 27, 2022 9:41 AM
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")
![]() | Make sure to subscribe to our YouTube channel where you can find the HubSpot Community Developer Show |