Posted on
01-14-2016
06:24 AM
- last edited
a week ago
by
kh-richa_mig
Hello,
I am trying to add users to a usergroup using the JSS Rest API.
Reading the documentations the request should look like this:
<user_group>
<user_additions>
<user>
<id>1</id>
</user>
</user_additions>
</user_group>
However, I get a HTTP 400 (Bad Request) in return from the server.
Is there something wrong in the XML?
See the image below for Update note.
Posted on 01-14-2016 07:14 AM
@actademo try using this XML data format:
apiData="<user_group><user_additions><user><id>{id}</id></user></user_additions></user_group>"
Where you replace {id} with the ID number or a variable representing the ID. I just tested on my JSS and that will add a user to a User Group. I know that the XML lists it as a plural (<user_groups>), but I found that it is not in fact plural. Same with <user> instead of <users>.
Posted on 01-14-2016 07:55 AM
@stevewood I used your XML (wich is the same as my XML?) and still get the 400 Bad request..
Posted on 01-14-2016 07:58 AM
@stevewood Found the mistake... I was consuming the UpdateUser address instead of the UserGroup address... stupid mistake