Infos:
- Used Zammad version: 3.2.x
- Used Zammad installation source: Not sure
- Operating system: Ubuntu 18.0.4 LTS
- Browser + version: Chrome + newest
Expected behavior:
Create a User with listed Attributes (all fields exist in Zammad).
Actual behavior:
Error-Code: {“error”:“Minimum one identifier (login, firstname, lastname, phone or email) for user is required.”}
Steps to reproduce the behavior:
$ch = curl_init();
$postfields = array(
‘firstname’ => ‘Helmut’,
‘lastname’ => ‘Ja’,
‘email’ => ‘helmut.ja@arcor.de’,
‘phone’ => ‘0164958685’,
‘address’ => ‘Irgendeine Adresse’,
‘roles’ => [‘Customer’],
‘login’ => ‘helmut.ja@arcor.de’,
‘password’ => ‘mypass’,
‘organization’ => ‘Pfitzenmeier’, //this one already exists, shouldn’t be the problem
‘invite’ => true //email to new customer
);
$jsonfields = json_encode($postfields, true);
/*
echo $jsonfields;
{“firstname":“Helmut”,“lastname”:“Ja”,“email”:"helmut.ja@arcor.de”,“phone”:“0164958685”,“address”:“Irgendeine Adresse”,“roles”:[“Customer”],“login":"helmut.ja@arcor.de”,“password”:“mypass”,“organization”:“Pfitzenmeier”,“invite”:true}
*/
curl_setopt($ch, CURLOPT_URL, ‘https://my.zammad.de/api/v1/users’);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘POST’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
‘Authorization: Bearer myToken’ //myToken is created with all rights!
));
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonfields);
$result = curl_exec($ch);
echo $result; //throws Error
curl_close($ch);
That’s my code so far, but i always get the same Error. Is anybody able to help me?
Thanks in advance!