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.