-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to perform a search based on email address without throwing exception? #27
Comments
Right now, the only way to achieve that would be to *catch* the exception
but there's an open PR for a CreateOrUpdate they might help going forwards.
…On Sun, 15 Jul 2018, 06:46 ssharma0312, ***@***.***> wrote:
email = ***@***.***"
var api = new HubSpotApi(hubspotApiKey);
var contact = api.Contact.GetByEmail(email);
here the contact variable throws exception right away, is there any way we
use this api to just perform search to check if this email address exist
already or not without throwing exception. Since hubspot doesn't allow
duplication or overriding so in order for the application to thrown
exception, I want to implement alogic to check if contact already exist or
not. Thanks in advance
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#27>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADng6_rSNqxJB4Rs_0yMeyiatADG1Xkiks5uGtdOgaJpZM4VQH6w>
.
|
👋 Chris from HubSpot here. You may be interested in using the Contacts Search API Endpoint, which I've confirmed will not throw an exception if you search for an email that doesn't exist, but rather returns a 200 HTTP status code. The existing
I'd be more than happy to take a look at a PR for this if someone has the time to put one together. |
Hi Chris - thanks for reaching out! That endpoint looks it would work well and would be a great addition to the wrapper. I'd suggest adding it as a new endpoint - overall, we're trying to mirror the HubSpot API and hence the GetByEmail() method still has its place! |
We just released version 0.6.16 which includes a contact CreateOrUpdate method which might be helpful here too if that's what you were trying to do? |
I'll shortly be releasing v0.6.17 which includes the Search endpoint that @chrisbaldauf mentioned - thanks to @Mark-RSK! |
Glad to help. This library has saved me a load of time 👍 |
email = "abc@test.com"
var api = new HubSpotApi(hubspotApiKey);
var contact = api.Contact.GetByEmail(email);
here the contact variable throws exception right away, is there any way we use this api to just perform search to check if this email address exist already or not without throwing exception. Since hubspot doesn't allow duplication or overriding so in order for the application to thrown exception, I want to implement alogic to check if contact already exist or not. Thanks in advance
The text was updated successfully, but these errors were encountered: