Posted on 11-10-2022 01:58 AM
I'm a school teacher, I recently got a new batch of m1 mac computers, I want to use "api/preview/mdm/commands" in the api of jamf to set the recovery lock, but I don't know why but it keeps reporting an error, the error is as follows, have you encountered the same problem?
curl -X POST "" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiMTgwODkwYTMtMGRmYy00YWM0LWJkNTItMmE0ZjZjYTUxOWEzIiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiIyIiwiZXhwIjoxNjY4MDc0ODAxfQ.Qn8KTQztpl55jdjB-gRIsvQ42wUoshG09OCSrVmwfms" -H "Content-Type: application/json" -d "{\"clientData\":[{\"managementId\":\"aaaaaaaa-3f1e-4b3a-a5b3-ca0cd7430937\"}],\"commandData\":{\"commandType\":\"ENABLE_LOST_MODE\"}}"
500 | Error:Response bodyDownload { "httpStatus": 500, "errors": [ { "code": "SYSTEM_EXCEPTION", "description": "Unable to perform MDM operation", "id": "0", "field": null } ] } Response headerscache-control: no-cache, no-store, must-revalidate content-type: application/json date: Thu, 10 Nov 2022 09:43:30 GMT expires: 0 server: Jamf Cloud Node strict-transport-security: max-age=31536000; includeSubdomains;, max-age=31536000 ; includeSubDomains x-frame-options: DENY x-xss-protection: 1; mode=block |
Posted on 11-10-2022 05:58 AM
I see at least a couple of issues with what you're trying to submit.
First, a POST shouldn't include a -H "accept: application/json" header. That's for receiving data not sending data. You do have a -H "Content-Type: application/json" header, which is good. You'll only ever include one or the other not both.
Second, I don't see a URL. Maybe you've left that out for brevity, but without it here, we can't be sure your curl command is correct.
Here's an older script to enable Lost Mode using the Classic API. It may help you with what you're trying to do. Note the comment someone added at the bottom.
https://gist.github.com/talkingmoose/f44d0d87d08b48daa0e887a6239c1766