Trouble getting user data


#1

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&property=number_of_purchases

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

Any help would be wonderful!

Thanks


#2

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

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


#3

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?


#4

@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.


#5

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&propertyMode=value_only&property=number_of_purchases

And still got a ton of extra data.

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


#6

@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.


#7

Fair enough.

Thanks for the assist!

Steve