Mautic Community Forums

Reset contact fields with Mautic API

Mautic version : 2.13.1
PHP version : 5.6

Api works perfectly to modify my contact, by adding new values to my multiple select field tags :

        $response = $client->request('POST', 'contacts/new',[
            'auth' => ['mymail', 'mdp'],
            'form_params' => [
                'email' => $this->getUser()->getEmailCanonical(),
                'tags' => ['water','fire']
            ]
        ]); 

But when I send new ones with API, it just add to the list but do not delete previous tags.
For example if I send [‘water’,‘wind’], I’ll get [‘water’,‘fire’,‘wind’].
Steps I have tried to fix the problem:
I have tried to give an empty array but it doesn’t work.

Thanks :-).

1 Like

I have tried to empty the user with a PATCH request that send nothing, it keep the user just with ip address and emtpy every data, but then I can’t refill the contact with data.

Anyone have an idea ?