While going over Mautic’s REST API documentation to learn how to edit contacts, I had faced a question.
Given that the a contact’s ID field is internal to mautic (it’s set automatically when creating a contact and not related to any other 3rd party ID field), how can one know what is the ID of the contact he would like to edit?
As I expect that the unique property of contacts is the email field, how can I edit a contact via the API using the email as an identifier?
I did a little research and found that if I call the /create/ with an existing email address, it will modify the existing contact with the given email. As this is not very intuitive (and not documented), I was wondering if this is the correct way of doing things.
Sorry if the solution is trivial and I haven’t figured it out, but mostly an internal ID field isn’t being used as an identifier for an external API usage.
Thanks in advance.
So the two ways I found in order to achieve that are:
- Calling /contacts/new with an existing email address, which will modify the contact
- Calling /contacts with where clause, which has a horrific syntax (see an example below).
Am I missing a different, better, way of editing a contact? This should be so intuitive to do!
Where clause example: