Create Static Groups With API

sdecook
Contributor

Does anyone have a script that will create static groups using the API? I read the the documentation and found the mobiledevicegroups section which talks about creating groups using the POST command. However I cannot get the syntax correct. I searched around and couldn't find anything that looked like what I needed. I am trying to create static groups with iPads in them for use in our shared iPad environment. I have around 100 or so that I need to create and wanted to save myself some time.

3 REPLIES 3

jmahlman
Valued Contributor

I have a script that will read the computer name and, based on our naming convention of <Room>-<Machine Type><Number> (ex: T801-M01 or T1123-K03) and then assign it to the static group that it belongs to. We don't use a smart group for this mainly because we don't want problems with people renaming machines or if their machine has the name somehow.

You can find my script here

EDIT: I misread your post, it looks like you're trying to create new groups, this script will not do that but can be modified easily to do it I'm sure.

sdecook
Contributor

I figured out the API call to make it happen. I am all new to this so I did not quite get the syntax. With the help of some others I was able to create a static group using the following.

curl -k -v -u username:password https://address.jamfcloud.com/JSSResource/mobiledevicegroups/id/0 -X POST -H "Content-Type: text/xml" -d "<?xml version="1.0" encoding="UTF-8"?>""<mobile_device_group><name>Name</name><is_smart>false</is_smart><site><name>none</name></site></mobile_device_group>"

Now I just need to write a script to pull the data out of a CSV. Thank you guys for the help.