Does anyone have a example of creating a AtTask user using Invoke-RestMethod? Have tried the following Invoke-WebRequest "https://company.attask-ondemand.com/attask/api/user?emailAddr=user@domain.com&firstName=user&lastName=name&password=Pa$$w0rd&sessionID=jjsaduu298901283123j" -Method post which returns bad request... Thanks in advance!
问题:
回答1:
Place the new user information in a json array in a field named updates. Specify the method you are doing. in this case: &method=post. Then you need to pass the session id or the admin's username and password. I changed your above url to what it needs to look like.
"https://company.attask-ondemand.com/attask/api/user?updates={ emailAddr:user@domain.com,firstName:user,lastName:name,password:Pa$$w0rd}&method=post&sessionID=jjsaduu298901283123j
or
"https://company.attask-ondemand.com/attask/api/user?updates={ emailAddr:user@domain.com,firstName:user,lastName:name,password:Pa$$w0rd}&method=post&username=admin_email&password=admin_password
Let me know if that does not work.
回答2:
Creating and setting up a user in AtTask is effectively a three step process.
Step 1: Create the user. This is pretty straight forward. Set the First and Last name, e-mail and any group ID, job role. No password yet.
Step 2: Call the named action "assignUserToken". This will return an array with the token value under 'result'
Step 3: Now call another named action, "completeUserRegistration". You will need to pass it the ID, First Name, Last Name, Password to set, and the Token.
That's it, you are done. Regarding step 3, I have no idea why you need to pass the first and last name in again when you are passing the ID, but it doesn't seem to work without it.