API - Creating a ne...
 
Notifications
Clear all

API - Creating a new Peer User

3 Posts
2 Users
0 Reactions
874 Views
Posts: 8
Topic starter
(@adprice7)
Active Member
Joined: 7 years ago

I'm trying to use the API to create a new peer user, however i keep getting the return code -2, so i'm a bit stuck.  Here's some code which will reproduce what i'm doing (in powershell)
$loginusername = "insert username here"
$loginpassword = "insert password here"  | ConvertTo-SecureString -AsPlainText -force
$mycreds = New-Object System.Management.Automation.PSCredential($loginusername, $loginpassword)
$myproxy = New-WebServiceProxy -uri "http://192.168.55.10:9002/esUsers.asmx?WSDL" -Credential $mycreds
$default = [Type]::Missing
$username = "MyNewUser"
$password = "SecurePassword123!"
$email = "my.email@mydomain.com"
$myproxy.AddUserLiteral(1,1,1,$true,$false,$username,$password,$username,$default,$email,$default,$default,$default,$default,$default,$default,$default,$default,$default,$default,$false,$default,$false,$false)

I've tried several different ways of doing this, but i just can't get the user created.  I've verified that the first three values are supposed to be 1 (these are ownerId, roleId and statusId) by checking the settings on existing users.  Can anyone assist please?

2 Replies
Posts: 1509
Admin
(@trobinson)
Noble Member
Joined: 9 years ago

Hello,
That looks like the correct way of calling the API.
Can you confirm you are using the ServerAdmin account to create the peer?

Thanks,

Trevor

Reply
Posts: 8
Topic starter
(@adprice7)
Active Member
Joined: 7 years ago

Thanks for the prompt reply.  Yes, I am using the serveradmin account to create the peer.  Interestingly it does look to possibly be a permissions issue because changing the first value (1) to a different ID creates the user (although this is then a different ownerId, so the account is a peer of a different user rather than a peer of serveradmin).

Reply
Share: