1b.app
Link copied -

How to search for a record by one of the attributes?

I want to search by last name, first name or email. And in case of absence, create this contact via API. Didn't find how to search. Can you help.
Original question is available on version: ru

Answers:

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license
If you have the ability to make multiple requests, then:
- there is such a method https://1b.app/ru/api/get-user-by-phone/ but it allows you to search only by phone number
- there is such a method https://1b.app/ru/api/users/ where you need to use "Parameters for getting one contact", and in the request parameters you need to specify one of the parameters
In any case, you need to first check the phone, then check the mail or vice versa, and only then create a contact using /api/contact-add/json/
As for the name, this is not a unique parameter, although you can try to specify the name, namelast or contactNamefull parameters, but they are not declared as working (but it can work), although even if it works, then by the name of Sergey, you can get 20 contacts and which one them to choose a difficult question
07.12.2021, 10:48
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license
This was an example for Api v1
As for API v2, there is no such possibility
07.12.2021, 10:49
Original comment available on version: ru

for API v1, you can use the search described in this topic:
https://1b.app/ru/support/changelog-2018-onebox-revolution/4985-2015010738---dor...
07.12.2021, 14:44
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license

Maria
OneBox production wrote:
for API v1, you can use the search described in this topic:
https://1b.app/ru/support/changelog-2018-onebox-revolution/4985-2015010738---dor...

it will give several options, not quite suitable, here you need to check and create if there is no such
07.12.2021, 15:29
Original comment available on version: ru


Sukhanitsky Andrey
OneBox Corp.
Integrator wrote:
it will give several options, not quite suitable, here you need to check and create if there is no such

If it gives several options, then at least 1 contact fits the given conditions and it is not required to create a new contact? I just gave an example of what can be used to search
For APIv2, you can use the Get contacts list method and pass name/namelast/email in the filter to search for contacts, for example. You can also pass the number of returned contacts to this method and use it to get both 5 and 25 and 1 contact as a result
07.12.2021, 16:08
Original comment available on version: ru

Суханіцький Андрій OneBox CORP
OneBox Corp - Інтегратор
Personal license

Maria
OneBox production wrote:
For APIv2, you can use the Get contacts list method and pass name/namelast/email in the filter to search for contacts, for example. You can also pass the number of returned contacts to this method and use it to get both 5 and 25 and 1 contact as a result

japonyal, there in the scheme filters are described
07.12.2021, 19:56
Original comment available on version: ru

Please join the conversation. If you have something to say - please write a comment. You will need a mobile phone and an SMS code for identification to enter. Log in and comment