New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Cloudflare api - Identify and remove a record
For a project I need to remove a a record from a CF account. When I started I didn't think this would be hard. But now I reached that part and I'm stuck. I'm writing a bash script and I only have that ip and/or a record name. However according to the CF I need to know the record id.
http://snapr.pw/i/95be42bf75701e07e980dd6899ed56.png
And to get the record id I need to call rec_load_all. This will return all the records for that given domain. Now the problem is, how am I going to identify the right record id from the response from Cloudflare in bash?
Cloudflare api documentation: https://www.cloudflare.com/docs/client-api.html
Comments
Traverse, match the same fqdn or IP, then grab the record_id. I'd recommend PHP and execute via the command line. It will provide more functionality and you would exec just like bash anyway
Here's a snippet of code I have, though it might have an issue with www.something.com vs something.com. I can't remember if I fixed it or not. It's something to start off, I guess.
$tkn is your cloudflare API token
$email is your cloudflare email address