iControl REST 101: Deleting Objects

The goal of iControl REST 101 has been to get you up to speed on the killer new way that you can manage your BIG-IP. So far we’ve covered most of the basics. Whether you’re just trying to figure out how to connect to the device or list objects, or wanting to create or modify a particular piece of your config, we’ve covered it. This means that, if you’ve been following along, you’re now able to list, add, modify and manage nearly any object on your F5 devices with iControl REST.

That’s all well and good, but there’s a piece that’s missing in the lineup of basic operations that’s actually pretty important. What do you get when you can add objects rapidly, but have no way of removing them? Object sprawl, and a stressed DevOps team. Let’s avoid that and take a look at how to remove objects with iControl REST.

Fortunately, like the rest of the things we’ve covered so far, this is straight forward and easy. Just like before we’re relying on the HTTP method to dictate the type of transaction. For a delete we send, not shockingly, DELETE. And because we’re removing an already existing item the only information we need to pass in is the item name and path. Easy, right? Let’s take a look.

First let’s take a look at the object we want to remove:

As before, you can see the object output. Listing things like this is always a good idea, especially when doing things manually like we’re doing here for testing, to be sure we have the object we actually want before nuking anything. This is, in fact, the item bound for the bit bucket in our case, so let’s make with the destruction.

This cURL call will hopefully look completely familiar by now. The call is the same, listing the object name and the app/json content type. The only change is that we’re setting the method to delete and passing in no parameters whatsoever. No additional information is required to delete an object, after all.

As you can see there’s not much output. None, to be precise. That means things worked. If there had been an issue an error would have been returned. Still, though, it’s good to double check that all went according to plan, right?

Now we’ll run another list, just for grins and, as expected, get a confused expression from the BIG-IP as a result, since the object is no longer a member of this mortal plane of existence. Remember that before the IP in question was the 5th in the items array returned by jq. This time when we ask for that item we get a very different response:

With that, you’re now able to connect, list, add, modify and delete. That was my goal with the series, and with the basics covered you should be well on your way to iControl REST mastery and mayhem. There’s still more to cover, however, and I’ll be back with some more advanced concepts in future installments. For fun with partitioning, transactions and more, stay tuned.

Published Mar 26, 2014
Version 1.0

Was this article helpful?

5 Comments

  • It seems a key screenshot is missing. You can view it here: http://postimg.org/image/uuy4l6t3t/.

     

     

    Also, a couple of improvements for these iControl REST articles would be:

     

    1.) For your screenshots, use a text/bg color that is visible and easy to read.

     

    2.) Actually list the commands using the pre html tag, so that we can copy and paste, rather than having to type out the full commands.

     

     

    Otherwise, I have found the iControl REST articles very helpful! So, great job on making it easy to understand.
  • antonela_138498's avatar
    antonela_138498
    Historic F5 Account
    what is the syntax for the curl to DELETE? the window in the middle does not show anything, and there is no syntax i can see. I am having trouble deleting my object and i was hoping this would be a good reference point. Thank you.
  • Phil_S__73664's avatar
    Phil_S__73664
    Historic F5 Account
    I was able to use the DELETE method with the CURL to delete objects: curl -sk -u 'admin:admin' -X DELETE https://10.128.1.100/mgmt/tm/net/self/cw_test2 | /var/tmp/jq .