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.
- Chris_Pacheco_3Nimbostratus
i am trying to delete a monitor on a pool - when i try that it deletes my whole pool:
curl -sk https://densn-lbapp03.gwl.com/mgmt/tm/ltm/pool/P_QA_B_EASY_SVCS_RETIREMENTPARTNER \ -H X-F5-Auth-Token:K4IJYPGG3XILN5WFIT4PHCBCVH -H "Content-Type: application/json" \ -X DELETE -d '{"monitor": "/Common/M_MONEYIN_4000"}'
Can you tell me what i'm doing wrong?
- Andrew_Le_12873NimbostratusYes, screenshots need update, as they don't match what is being described.
- Phil_S__73664Historic F5 AccountI 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 .
- antonela_138498Historic F5 Accountwhat 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.
- Ian_124377NimbostratusIt seems a key screenshot is missing. You can view it here: http://postimg.org/image/uuy4l6t3t/.