I wanted to provision a unique email configuration profile ("Exchange ActiveSync") for each of 200 iPads, so they all get distinct email addresses in my Gmail domain at configuration time. Using the JSS API seems like a nice way to automate this, creating the .mobileconfig profiles uploading them to the JSS server and scoping them to individual iPads.
It took me two hours to get past the cryptic explanation for the apiExplorer information for the mobiledeviceconfiguration POST API. If you have tried this technique, maybe this discussion can help you get past 400 Bad Request errors. Here's what the documentation says:
"Note that payloads must be specified as xml. You can use Apple's iPhone Configuration Utility to create a .mobileconfig file that can be listed, in its entirety, as the value of the payloads element."
I finally got things to work like this:
Export the .mobileconfig file from IPCU (or make one yourself--it's a plist file).
Wrap it inside an XML document with a <configuration_profile> root, that contains a <general> element, inside of which are a <name> and a <payloads> element:
<?xml version="1.0" encoding="UTF-8"?>
<configuration_profile>
<general>
<name>New Profile Name</name>
<payloads>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>EmailAddress</key>
... rest of escaped .mobileconfig file goes here ...
</payloads>
</general>
</configuration_profile>
- POST it using curl or another method:
curl -k -v -u username:password -T "test.xml" -X POST https://myjss:8443/JSSResource/mobiledeviceconfigurationprofiles/name/New+Profile+Name
Finally got a 201 Created response after lots of failed experiments. Now I will have to see about adding the <mobile_device> information in the <scope> section to scope the profile to a specific device.