mzagmajster provided a workaround to install the PHP API library here.
This is a working example of an API call:
require ‘/home/username/public_html/mautic/vendor/autoload.php’;
use Mautic\Auth\ApiAuth;
use Mautic\MauticApi;$settings = [
‘userName’ => ‘administrator’,
‘password’ => ‘ouou79897password’,
];$initAuth = new ApiAuth();
$auth = $initAuth->newAuth($settings, ‘BasicAuth’);$apiUrl = ‘https://yourwebsite.com/mautic/api/’;
$api = new MauticApi();
$contactApi = $api->newApi(‘contacts’, $auth, $apiUrl);$id = 243;
$data = array(
‘firstname’ => ‘Donnie’
);// Create new a contact of ID 243 is not found?
$createIfNotFound = false;$contact = $contactApi->edit($id, $data, $createIfNotFound);
var_dump($contact);
Put this in a php file, run it in the browser, it will change the first name of your contact with ID 243 to ‘Donnie’.
var_dump($contact) outputs a scary amount of stuff. How can you echo $contact->firstname
or $contact['firstname']
? Those example don’t work of course.
Can you get a contact by email address instead of ID? Or another field?
There is some documentation here. Is there a complete list of the “options” anywhere?