Assuming that you're utilizing a static user group, you can pass XML similar to the following to add users to a static user group:
1<user_group>
2 <user_additions>
3 <user>
4 <id>1</id>
5 <username>Username</username>
6 </user>
7 <user>
8 <id>2</id>
9 <username>Username2</username>
10 </user>
11 </user_additions>
12</user_group>
In the example, only one of the <id> or <username> attributes is required to identify the user to add to the group. In terms of the actual command, I'd recommend using a tool like Postman, to generate code samples, after you've verified the inputs for your environment.
@Sam.Fortuna , do you know the command you would use to apply this to the JSS? I'm trying the following and it's not working:
1#!/bin/sh
2server="jssurl"
3username="apiusername" #JSS username with API privileges
4password="apipassword"
5staticGroup="ClassGroup"
6
7user=username
8
9#Add to class-specific Static Group
10groupData="<user_group><user_additions><user><username>$user</username></user></user_additions></user_group>"
11groupOutput=`curl -k -u $username:$password -H "Content-Type: text/xml" https://$server:8443/JSSResource/usergroups/name/$staticGroup -d "$groupData" -X POST`
I've tried both "PUT" and "POST" and neither seems to work. I'm using this same type of commands to add accounts to the JSS and it works fine, I just can't figure out how to use them to add the accounts to a static group.
Nevermind, I managed to get it working. My problem was that the Static Group was in a different Site than the user account, and I also switched from POST to PUT.
Glad to see you were able to resolve the issue. To provide some additional clarification, the "user_additions" attribute can only be used for PUT operations since the POST operation would be creating a new group, and the concept of adding a user to a group that doesn't yet exist wouldn't make sense.