Skip to main content
Question

JSS API - Delete command


Forum|alt.badge.img+7

Hey Nation!

Im looking into writing a script that will delete computers from JSS as an employee gets term and the laptop is returned to inventory. The command I have so far and seems to work, but I wanted to get your guys opinions on this, is as follows:

curl -X DELETE -u username:password https://jss.url.com:8443/JSSResource/computers/id/computerID

Thank you!

7 replies

Forum|alt.badge.img+16
  • Honored Contributor
  • 1054 replies
  • May 4, 2015

That looks about right : )

Here is the thread I started about it..

https://jamfnation.jamfsoftware.com/discussion.html?id=10188

C


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 97 replies
  • May 5, 2015

@gachowski Thank you!! That post actually helped out a lot!!


Forum|alt.badge.img+8
  • Contributor
  • 69 replies
  • February 10, 2016

here's a bash script that will take a CSV and blast them away. I'm currently using this to remove machines from an old JSS while migrating to a new one. Read the comments I posted there, it's slow, abusive, and works. Kind of like Sean Connery? Dunno.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • February 10, 2016

@krispayne Just looked at your script. Hate to tell you this, but wget is not a native binary in OS X, or at least not up to 10.10, maybe its part of 10.11 now? You might have installed it at one point, but admins trying to run your script may encounter an error since it won't be able to find the binary. You may want to switch it to use curl which is included in the OS. For something like this, there's no real advantage I know of to use wget as opposed to curl. Curl will get the job done.

To be sure I'm not completely crazy, I ran the following commands on my Yosemite 10.10.5 Mac-

which wget

and...

sudo find / -name wget

Neither returned anything. Contrast this will using curl as an example:

sudo find / -name curl
/usr/bin/curl

Forum|alt.badge.img+8
  • Contributor
  • 69 replies
  • February 10, 2016

Ack! Thanks, @mm2270 !

Only reason I'm using wget is to bypass the cert. We're using a JSS generated cert and I couldn't find the command in curl to bypass it. Always failed the handshake. If you happen to know that flag, I can definitely switch back to curl.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • February 10, 2016

@krispayne Does the -k flag in curl not do this? I'm not entirely sure, but I thought that allowed curl to bypass insecure connections due to something like self signed certificates.

From the curl manpage:

-k, --insecure (SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers. All SSL connections are attempted to be made secure by using the CA certificate bundle installed by default. This makes all connections considered "insecure" fail unless -k, --insecure is used.

Forum|alt.badge.img+8
  • Contributor
  • 69 replies
  • February 10, 2016

@mm2270 I definitely tried -k but I will give it another shot and see


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings