Error about Get Email Event By ID API


#1

Run into error when trying to pull data through this API.
Here is the codes i use, which run well for other requests:

response=urllib.request.urlopen(url).read().decode('utf-8')
email_events_ID=json.loads(response)

And the error is: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


#3

Hi @Xi_Wang,

Happy to help. That error generally indicates a formatting issue with the request.

To troubleshoot effectively, I'll need a bit more information. Would you share:

  1. Your Hub ID.
  2. The full request URL you used. (Specifically, I need to know the creation timestamp and event ID you used.)

#4

My Hub ID is 3432611. The URL I used is "/email/public/v1/events/:created/:id"
I would like to get all users' responses to the email events.


#5

Hi @Xi_Wang,

Thank you for the Hub ID, but I still need the full request URL you used so that I can replicate the behavior. You only shared the endpoint, which I already know.

For example, I need: https://api.hubapi.com/email/public/v1/events/1401715797602/fb5f4051-0bf9-3b3c-92f4-ffbab071ed66

Could you also clarify what you mean by "I would like to get all users' responses to the email events"? The endpoint you used only returns information for one particular event (e.g. one recipient's OPEN event).

If you want to see all recipient responses to an email campaign or an individual recipient, use this endpoint.


#6

Sorry for the confusion. My intention here is to get all user's responses for each campaign our team conducted.
I just realized that is not achievable through the endpoint I sent to u and it seems that GET /email/public/v1/events cannot achieve it.

My guess would be to get a list of campaign id first, then get users' responses for each campaign one by one.

Or what's ur opinion about it? Could u also help to point out what endpoints would be helpful?

I'm going through all related endpoints, and get a little confused since results I pulled out is very short. The following snapshot is the result I used GET /email/public/v1/events to export:

It does not show the action of users, such as 'open', 'click', etc.

Generally speaking, I would like to get a summary of all user's action towards each campaign. Hope it clarifies my intentions, and plz point out the wrong part of my approach. Thank you.


#7

Another question is: when I was trying to GET /contacts/v1/lists/all/contacts/all, there is offset issue, which prevented me from getting data automatically, since i need to know VID first before getting next page data, any advice to make it more automated? Thank you


#8

Hey @Xi_Wang,

Would you mind creating a new topic for the Contacts API question?

I'll try to get to both as soon as I can, but it helps to keep different questions separate.


#9

Already did, plz check Export data automatically under then constrain on offset


#10

Hi @Xi_Wang,

Apologies for the delayed response.

Could you clarify your definition of a "campaign"? Are you referring to marketing email campaigns?

Also, by "responses," are you looking for actual email replies, or just opens and clicks?

If you are trying to retrieve marketing email open and click information for each recipient, this endpoint can be used effectively.

To advise effectively, however, I need to know exactly what you're querying from the API, for example:

https://api.hubapi.com/email/public/v1/events/1401715797602/fb5f4051-0bf9-3b3c-92f4-ffbab071ed66&recipient=recipient@example.com

and what you are expecting to receive.

Screenshots of the response do not help me on their own. I need to know the full request URL.