Search code examples
phpattask

Create a user in Attask via REST API v3


When I try to POST user creation request it requires username and password to authenticate, but then I need to provide username for the new user. I can't understand how to write correct request for my task.

I'm using StreamClient.php, when I try to create a user I need to send post request:

$client->post('user', array('username' => $user, 'firstname' => $f, 'lastname' => $l));

If someone could provide a working example, it would be very helpful.


Solution

  • Dont use username for the new user. You would use "emailAddr" Try this:

    YOURDOMAIN.attask/api/user?updates={"emailAddr":"[email protected]","password":"userpassword"}&method=post&username=USERNAME&password=PASSWORD

    or if that does not work and you are using the StreamClient.php

    You should be logging in not in the same POST. For Example you would login:

    $login = $client->login('LOGIN_USERNAME', 'PASSWORD');

    Look at the StreamClientSample.php, around line 37 //login. developers.attask.com/api-docs/code-samples

    Let me know if that helps