Forum Discussion

kkara_240139's avatar
kkara_240139
Icon for Nimbostratus rankNimbostratus
Feb 05, 2016

How can I remove a DNS Cache Record Using F5 REST API

i want removing DNS old, invalid DNS cache records from F5 using REST API, but no resource or sample available. Using tmsh, it can be done within 3 commands like below; but we dont wanne use tmsh because of performance issues. Can any one done this before and can share the code sample? Thanks

 

response = sshService.execute("tmsh");

 

logger.info("TMSH response:" + response);

 

response = sshService.execute("ltm dns cache records");

 

logger.info("LTM response:" + response);

 

response = sshService.execute("delete rrset type a cache " + url);

 

logger.info("DELETE response:" + response);

 

response = sshService.execute("quit");

 

2 Replies

  • I can get all the different resource records from the rest interface like this:

    /mgmt/tm/ltm/dns/cache/records/rrset?options=cache+/Common/mycache+type+aaaa

    Except for "a" records, which errors out, so you might open a case on that. To remove them, you'll need the resource ID from that output, then you can just do a delete to here:

    /mgmt/tm/ltm/dns/cache/records/rrset/~resource id