Happy Monday all (🤣)
So last week after successfully making a script on the classic api to change a site for mac using bearer tokens and properly salted/hashed api creds, i'm now on to my next challenge of using the preview api to set the recovery lock ready for all these MBP M1 pro's that are arriving shortly :-
https://developer.jamf.com/jamf-pro/reference/post_preview-mdm-commands
so after getting to grips and trying to utilise the nice example generator, i send this to it in a script but all i get back is " [ ] " so not even a proper rejection.
can I assume first that the "managementid" is the UDID of the device and the clienttype is correct for a macOS device?? code below..
NB. its worth noting in actually passing the managementid as a "'"$UDID"'" as i am running this script locally grabbing the udid via the MBP's serial number from the classic api. I still get the same response..
curl --location --request POST "$jamfpro_url/api/preview/mdm/commands" --header "Authorization: Bearer ${api_token}" --header 'Accept: application/json' --header 'Content-Type: application/json' --data '
{
"clientData": [
{
"managementId": "aaaaaaaa-3f1e-4b3a-a5b3-ca0cd7430937",
"clientType": "COMPUTER"
}
],
"commandData": {
"commandType": "SET_RECOVERY_LOCK",
"newPassword": "banana01"
}
}'
i deliberately send a bad command though to make sure it was responding properly, but the SET_RECOVERY_LOCK is right despite the documentation thinking it was "SetRecoveryLockCommand" :-
{
"httpStatus" : 400,
"errors" : [ {
"code" : "INVALID_FIELD",
"description" : "Could not resolve type id 'test' as a subtype of `com.jamfsoftware.mdm.web.dto.command.CommandDto`: known type ids = [DELETE_USER, ENABLE_LOST_MODE, LOG_OUT_USER, RESTART_DEVICE, SETTINGS, SET_RECOVERY_LOCK] (for POJO property 'commandData')",
"id" : "0",
"field" : "commandData"
} ]
}