api-library icon indicating copy to clipboard operation
api-library copied to clipboard

API contact edit method is not working

Open faisalsarfraz opened this issue 4 years ago • 2 comments

Something strange happening on Mautic version 3.3.3 and API version 3.0 Edit a contact method is not working. I have this

$data  = array(
                                'cancellation_date' =>date('Y-m-d'),
		               'acc_cancelled_flag' => 1
		);
		$initAuth = new ApiAuth();
		$auth = $initAuth->newAuth(mauticConnection(), 'BasicAuth');
		$timeout = 10;
		$auth->setCurlTimeout($timeout);
		$api = new MauticApi();
		$contactApi = $api->newApi("contacts", $auth, checkMauticUrl());
		/*Get User*/
		$contacts = $contactApi->getList("email:$email");
		//dd($contacts);
		if (!empty($contacts['contacts'])) {

			$user_id = array_key_first($contacts['contacts']);
			/*Update User Details*/
			$response = $contactApi->edit($user_id, $data, false);

		}

This is the method that I am using but its not udpating those two columns. Does somebody has solution?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

faisalsarfraz avatar Jun 23 '21 17:06 faisalsarfraz

What is your $response?

kuzmany avatar Jun 23 '21 20:06 kuzmany

Response is contact printed in form of object.

On Thu, Jun 24, 2021, 1:26 AM Zdeno Kuzmany @.***> wrote:

What is your $response?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mautic/api-library/issues/254#issuecomment-867134481, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKOWAYXP3H54FMG5KWJR3LTUI7P3ANCNFSM47GHLKDQ .

faisalsarfraz avatar Jun 23 '21 21:06 faisalsarfraz