pipedrive / client-nodejs

Pipedrive API client for NodeJS
MIT License
205 stars 82 forks source link

Persons.find() with exact_match:true not matching exact #108

Closed jonathanstokes closed 4 years ago

jonathanstokes commented 4 years ago

Not sure if this a due to a change in the API behavior or something that's always been there, but I noticed if I search for a person by email:

pipedrive.Persons.find({
  term: 'self@example.com',
  exact_match: true,
  field_key: 'email',
  field_type: 'personField',
  return_item_ids: true
})

The results will include matches for the following if they exist as Persons in Pipedrive:

It might be that this only happens if there is no exact match in Pipedrive, I'm not sure, but either way this seems like a bug, since exact_match: true should cause only self@example.com to be matched.

RuTsEST commented 4 years ago

Hello! Sorry for the late response. There is no exact_match key available in the /persons/find endpoint. Please have a look at https://developers.pipedrive.com/docs/api/v1/#!/Persons/get_persons_find to see how to use that endpoint appropriately.

jonathanstokes commented 4 years ago

@RuTsEST, thanks for the update. I think that makes sense... it was less clear in the pipedrive/client-nodejs readme when this issue was filed. It's still not spelled out explicitly in that doc, but the examples improve things in the version that was just added a few weeks ago.

Still, can this be treated as (or converted to) a feature request for the API? In other systems, using email address as a unique identifier is pretty common, so being able to look up a Person (or Persons, I suppose) in Pipedrive associated with a specific email address seems like a common use case. Requiring a fuzzy match that will bring back Persons with other email addresses does not seem practical.

RuTsEST commented 4 years ago

@jonathanstokes I'll contact the relevant people and will give any updates in the upcoming days.

RuTsEST commented 4 years ago

@jonathanstokes Hey! Got this feedback from the search team:

That endpoint will be deprecated in the next month or so. We will also roll out new search public API which has the expected behavior described there and much more!

So look forward to that!