Unable to use DELETE function in JAMF School API

asaraca
New Contributor II

Hello,

I'm trying to use the DELETE API in the JAMF School API but without success. What am I doing wrong ?

curl -X DELETE -H "Accept:application/json" -H "X-Server-Protocol-Version: 3" -H "Authorization: Basic xxxxxxxx" https://apiv6.zuludesk.com/users/:3801107
{"code":404,"message":"UserNotFound"}

curl -X DELETE -H "Accept:application/json" -H "X-Server-Protocol-Version: 3" -H "Authorization: Basic xxxxxxx" https://apiv6.zuludesk.com/users/3801107
{"code":404,"message":"UserNotFound"}

Thank you,

Antonio

10 REPLIES 10

asaraca
New Contributor II

Forgot to mention that the user 3801107 exists in our JAMF School database :)

shaquir
Contributor III

Hi @asaraca,
The:

https://apiv6.zuludesk.com/users/3801107

May need to be:

https://apiv6.zuludesk.com/JSSResource/users/id/3801107

Or if 3801107 it is the name:

https://apiv6.zuludesk.com/JSSResource/users/name/3801107

Also, I know json and Jamf's Api integration can sometimes get tricky

@iMatthewCM Has a great set of jamf API scripts on his Github

asaraca
New Contributor II

Still not working :(

curl -X DELETE -H "Accept:application/json" -H "X-Server-Protocol-Version: 3" -H "Authorization: Basic xxxx" https://apiv6.zuludesk.com/JSSResource/users/name/3801107
{"error":{"code":404,"message":"Not found"}}

curl -X DELETE -H "Accept:application/json" -H "X-Server-Protocol-Version: 3" -H "Authorization: Basic xxxx" https://apiv6.zuludesk.com/JSSResource/users/id/3801107
{"error":{"code":404,"message":"Not found"}}

shaquir
Contributor III

In it's simplest form, this should work:

curl -sku "Username":"Password" "https://apiv6.zuludesk.com/JSSResource/users/id/3801107" -X DELETE

If you need to use with base64 authorization:

curl -sk -H 'authorization: Basic xxxxxxx' "https://apiv6.zuludesk.com/JSSResource/users/id/3801107" -X DELETE

There are some great Jamf API videos online including:
Getting Started With the Jamf API Part 1 – Kitzy

Hands on with the Jamf Pro API Part 1

asaraca
New Contributor II

It still doesn't work. The problem I think is that we are using JAMF School and not JAMF Pro and the API don't seem to work the same way :(

afarnsworth
Contributor

Using https://apiv6.zuludesk.com/docs/#api-Users-Delete as a reference

Your curl command should look like:

curl -X DELETE "https://api.zuludesk.com/users/:id" --header "Content-Type: application/x-www-form-urlencoded; charset=utf-8" --header "Authorization: Basic xxxxx"

Does it work if you add the Content-Type to the header?

@afarnsworth Kindly let me know what's that content-type? As I'm getting below error message when I use Delete parameter in curl.

 

Screen Shot 2023-06-05 at 2.26.14 pm.png

 

asaraca
New Contributor II

Sadly no, I still have the "user not found" error.

asaraca
New Contributor II

Finally I found the error: the id is not the id in the JAMF School web interface, but the id returned by the API.

Spattent
New Contributor

I don't know why but I am facing a similar kind of issue with the API.