APIs & Integrations

Benchmark_achen
Participant

I can't see one of Email Opt-out field in the Get Contact API

SOLVE

Hi,

I'm trying to retrieve some of the Email Opted-Out fields from Hubspot into our database using the following API:

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=bnid_&property=email&property=hs_...

 

When run this API, I can see all the fields in the list return with the exception hs_email_optout_8324033

 

Can someone let us know what should I do to make this field return as well?

 

Thanks,

Allan

0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

I can't see one of Email Opt-out field in the Get Contact API

SOLVE

Hey @Benchmark_achen,

 

Upon digging further into this, I believe I would be able to shed some lights here.

 

The reason why you're not seeing property hs_email_optout_8324033 is likely because on the first page of the return result (first 100 contacts that you retrieved), there's no contact with this property set (not even set with a "" value).

 

As such, the property isn't showing up.

 

If you'd like to return property even if it's null, you may want to explore the option of using CRM API | Contacts:

 

GET crm/v3/objects/contacts?limit=10&properties=hs_email_optout_8324033%2Cbnid_%2Cemail%2Chs_content_membership_status%2Chs_email_optout%2Chs_email_optout_6236625%2Chs_email_optout_7778519%2Chs_email_optout_6236646&archived=false&hapikey=yourHapikey

 

This should return all properties stated on the query parameter for each contact records even if the property is null. 

 

Let me know if this works for you 🙂 

View solution in original post

5 Replies 5
WendyGoh
HubSpot Employee
HubSpot Employee

I can't see one of Email Opt-out field in the Get Contact API

SOLVE

Hey @Benchmark_achen,

 

Taking a look at request URL, I noticed that there's a double `&&` in the request url parameter:

 

&property=hs_email_optout_6236646&&count=100

 

if we remove one of the &, like this: 

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=bnid_&property=email&property=hs_...  --> this should return property hs_email_optout_8324033.

 

Could you try and see if this works?

0 Upvotes
Benchmark_achen
Participant

I can't see one of Email Opt-out field in the Get Contact API

SOLVE

Nope, that field still doesn't show up.  Here is the updated URL:

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?property=bnid_&property=email&property=hs_...

 

Here is the output (I'm using the ZappySys JSON Source SSIS components to run this URL):

output.PNG

0 Upvotes
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

I can't see one of Email Opt-out field in the Get Contact API

SOLVE

Hey @Benchmark_achen,

 

Upon digging further into this, I believe I would be able to shed some lights here.

 

The reason why you're not seeing property hs_email_optout_8324033 is likely because on the first page of the return result (first 100 contacts that you retrieved), there's no contact with this property set (not even set with a "" value).

 

As such, the property isn't showing up.

 

If you'd like to return property even if it's null, you may want to explore the option of using CRM API | Contacts:

 

GET crm/v3/objects/contacts?limit=10&properties=hs_email_optout_8324033%2Cbnid_%2Cemail%2Chs_content_membership_status%2Chs_email_optout%2Chs_email_optout_6236625%2Chs_email_optout_7778519%2Chs_email_optout_6236646&archived=false&hapikey=yourHapikey

 

This should return all properties stated on the query parameter for each contact records even if the property is null. 

 

Let me know if this works for you 🙂 

Benchmark_achen
Participant

I can't see one of Email Opt-out field in the Get Contact API

SOLVE

Thank you @WendyGoh !

 

Yes, you were right.  The count was too low to get any data out of field hs_email_optout_8324033.  I expanded the count to 10000 and this field finally shows up.

 

Thanks again!

--Allan

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

I can't see one of Email Opt-out field in the Get Contact API

SOLVE

Hey @Benchmark_achen,

 

This is interesting. I'm also seeing the same behavior. 

 

In this case, I'll have to work together with our internal team on this and I'll keep you posted here!

0 Upvotes