I'm having trouble with the API and making changes with JSON.
First, it's confusing because when looking at https://jamf.domain.com:8443/API and testing /mobiledeviceapplications, the output JSON looks to be missing keys when compared to the XML version.
In this pic, you can see that the XML returns a <mobile_device_group> element for each group inside the <mobile_device_groups> element. In the JSON version, the mobile_device_group key is missing and the groups are directly underneath the mobile_device_groups key.
Second, when it comes to sending data to /mobiledeviceapplications, I can get XML to work, but not JSON. In my JSON tests, I've tried with the mobile_device_group key added and removed, but neither work.
Here's the tests I'm using:
jssuser="jssuser"
jsspass="jsspass"
jssserver="https://jamf.domain.com:8443"
#WORKING XML
curl -k -s -u $jssuser:$jsspass -X PUT -H "Content-Type: application/xml" -H "Accept: application/xml" -d '<?xml version="1.0" encoding="UTF-8" ?><mobile_device_application><scope><mobile_device_groups><mobile_device_group><id>883</id></mobile_device_group><mobile_device_group><id>128</id></mobile_device_group></mobile_device_groups></scope></mobile_device_application>' $jssserver/JSSResource/mobiledeviceapplications/id/171
#NON-WORKING JSON WITH mobile_device_group
curl -k -s -u $jssuser:$jsspass -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -d '{"mobile_device_application": {"scope": {"mobile_device_groups": {"mobile_device_group": [{"id": "883","name": "+test+"},{"id": "128","name": "+tech+"}]}}}}' $jssserver/JSSResource/mobiledeviceapplications/id/171
#NON-WORKING JSON WITHOUT mobile_device_group
curl -k -s -u $jssuser:$jsspass -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -d '{"mobile_device_application": {"scope": {"mobile_device_groups": [{"id": "883","name": "+test+"},{"id": "128","name": "+tech+"}]}}}' $jssserver/JSSResource/mobiledeviceapplications/id/171
Can anyone shed some light on the issue? Are we not able to do API PUTs with JSON or is there a bug in the API?