question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getContactByEmail should expose idProperty

See original GitHub issue

I would expect the contacts api to be able to get by email. hubspot.crm.contacts.basicApi.getById(email);

But, from what I can see idProperty is not settable in the getById

const eventResponse = await hubspot.apiRequest({
      method: "GET",
      path: `/crm/v3/objects/contacts/${email}`,
      qs: { idProperty: "email", properties: [] },
    });

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
dreadjrcommented, May 25, 2022

Yes, there are many ways to get the result. Although searching for a user and GETing a user by an identifier are very different. Also, the responses may be different. I wasn’t looking for a workaround, because yes, there are many; one I posted in the original post. The main motivation for some of the tickets is to align the API and the SDK. Options that are supported in the API should be exposed via the SDK in their corresponding methods.

An example would be

hubspot.crm.contacts.basicApi.getById(email, { idProperty: "email", properties: [] });
OR
hubspot.crm.contacts.basicApi.getByEmail(email);

You can see from my original post this is supported by the API, just not the SDK.

I ended up writing my own library because of the inconsistencies I found.

1reaction
rfrank-usgbcommented, May 25, 2022

@ksvirkou-hubspot see @dreadjr post above ^

Read more comments on GitHub >

github_iconTop Results From Across the Web

getContactByEmail should expose idProperty #183 - bytemeta
getContactByEmail should expose idProperty #183. I would expect the contacts api to be able to get by email. hubspot.crm.contacts.basicApi.getById(email);.
Read more >
API Integration - Get contact by email address
To use an email address as the unique identifier, set the idProperty as email and enter the email address in place of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found