APIs & Integrations

Steve-a-reno
Participant

Trouble getting user data

I’m trying to search my contacts by the contact email address, but i keep getting a “contact does not exist” error.

Here’s what I’ve tried:
https://api.hubapi.com/contacts/v1/contact/email/neilsj0866@sbcglobal.net/profile?hapikey=demo

I’ve also tried setting up an app developer account to have my own hapikey, and that doesn’t work either.

Not sure where I went wrong.

What I really want to do is query the API by email address to get the value of a field in the properties list like below.
https://api.hubapi.com/contacts/v1/contact/email/neilsj0866@sbcglobal.net/profile?hapikey=demo&prope...

But if I can’t query for the contact, I won’t be able to get anything else.

Any help would be wonderful!

Thanks

0 Upvotes
6 Replies 6
Steve-a-reno
Participant

Trouble getting user data

Thanks for the reply.

It’s a step in the right direction, but is there a reason the api returns everything about the user and not just the property info I was looking for?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Trouble getting user data

@Goran
By default, all valued properties will be included. If you include the “property” parameter, then the returned data will only include the property or properties that you request.

Here is a link to the docs on how to implement that.

Search for a contact by email address | Contacts API

GET /contacts/v1/contact/email/:contact_email/profile - For a given portal, return information about a single contact by its email address.

0 Upvotes
Steve-a-reno
Participant

Trouble getting user data

So it’s not really clear how to construct the query.

Tried this:

https://api.hubapi.com/contacts/v1/contact/email/neilsj0866@sbcglobal.net/profile?hapikey=MyHapiKey&...

And still got a ton of extra data.

Anyway to narrow it down to return something like {“1”} ?

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Trouble getting user data

@Goran
There isn’t a way to break it down to something as simple as your example there. You will receive the general structure on the contact. You will have to parse the JSON for the value that you want. The only thing you can cut down is the amount of properties you receive with in the properties object.

0 Upvotes
Steve-a-reno
Participant

Trouble getting user data

Fair enough.

Thanks for the assist!

Steve

3PETE
HubSpot Employee
HubSpot Employee

Trouble getting user data

@Goran,
you don’t need a dev account to get your hapikey. Here is a link that will help you get it.

How do I get my HubSpot API key?

Marketing Basic, Professional, and Enterprise customers and portals with a CRM can access the HubSpot API. Learn how to access your HubSpot API key here.

Once you have your hapikey try and make the call again replacing demo with your key.

0 Upvotes