{"info":{"_postman_id":"2c552d54-2dbc-4e35-9691-b6519a6fbc19","name":"CloudFlare - Bulk remove DNS records","description":"<html><head></head><body><h2 id=\"remove-all-your-dns-records-into-cloudflare\">Remove all your DNS records into CloudFlare</h2>\n<hr>\n<ol>\n<li>Configure variable \"domain\" with your CloudFlare registered domain.</li>\n<li>api_email is your login email</li>\n<li>api_key is available here : <a href=\"https://dash.cloudflare.com/profile/api-tokens\">https://dash.cloudflare.com/profile/api-tokens</a></li>\n</ol>\n<hr>\n<ul>\n<li>zone_identifier will be found by the first request</li>\n<li>recordToDelete will be found by the second request</li>\n</ul>\n<hr>\n<p><a href=\"https://medium.com/@quentinrozados/how-to-remove-all-cloudflare-dns-bulk-remove-93bd2a0366ba\">https://medium.com/@quentinrozados/how-to-remove-all-cloudflare-dns-bulk-remove-93bd2a0366ba</a></p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"7648432","collectionId":"2c552d54-2dbc-4e35-9691-b6519a6fbc19","publishedId":"SzfCUkk2","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2020-04-27T15:31:56.000Z"},"item":[{"name":"Zone List","event":[{"listen":"prerequest","script":{"id":"afb43cad-4ed6-4b81-a8cf-39b4a6815928","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"a97a7f35-8e18-4975-8d6b-f8ed931ee280","exec":["var jsonData = pm.response.json();","","// Set Zone ID","if(jsonData.result.length) {","    pm.collectionVariables.set(\"zone_identifier\", jsonData.result[0].id);","    postman.setNextRequest(\"DNS List records\"); ","}"],"type":"text/javascript"}}],"id":"9d250d71-d51f-4d61-b871-a6bed94bee0d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"X-Auth-Email","value":"quentin@sinao.fr","type":"text"},{"key":"X-Auth-Key","value":"","type":"text"}],"url":"https://api.cloudflare.com/client/v4/zones?name=sinao.fr","urlObject":{"protocol":"https","path":["client","v4","zones"],"host":["api","cloudflare","com"],"query":[{"key":"name","value":"sinao.fr"}],"variable":[]}},"response":[],"_postman_id":"9d250d71-d51f-4d61-b871-a6bed94bee0d"},{"name":"DNS List records","event":[{"listen":"prerequest","script":{"id":"c858a956-fb1b-4a80-949f-7cf9a565a4b5","exec":[""],"type":"text/javascript"}},{"listen":"test","script":{"id":"2a1bd7ab-1310-4e03-87ac-9b459860d21e","exec":["var jsonData = pm.response.json();","","if(jsonData.result.length) {","    ","    // I want delete DNS for just this ip for my case","    var ipToDelete = '90.124.128.119';","    ","    // We are searching first occurence of this IP in content","    for(var i = 0; jsonData.result[i].content !== ipToDelete && i < jsonData.result.length-1; i++);","    ","    // If occurence was found, we prepare next request","    if(i < jsonData.result.length-1) {","        // Save id into collectionVariables in Postman","        pm.collectionVariables.set(\"recordToDelete\", jsonData.result[i].id);","        postman.setNextRequest(\"DNS Delete record\");","   } else ","        // Stop bulk","        postman.setNextRequest(null); ","    ","}"],"type":"text/javascript"}}],"id":"860fe629-2df7-4b29-bab6-ee048db204e3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"X-Auth-Email","value":"quentin@sinao.fr","type":"text"},{"key":"X-Auth-Key","value":"","type":"text"}],"url":"https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records","urlObject":{"protocol":"https","path":["client","v4","zones",":zone_identifier","dns_records"],"host":["api","cloudflare","com"],"query":[],"variable":[{"type":"string","value":"","key":"zone_identifier"}]}},"response":[],"_postman_id":"860fe629-2df7-4b29-bab6-ee048db204e3"},{"name":"DNS Delete record","event":[{"listen":"test","script":{"id":"ecbfdcfa-20a0-4aa3-854d-53388a65cec9","exec":["// Try again to find the next DNS record to delete, will be stopped when no results are found","postman.setNextRequest(\"DNS List records\");"],"type":"text/javascript"}}],"id":"41020414-012c-46bb-8409-54add428d12f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"X-Auth-Email","value":"quentin@sinao.fr","type":"text"},{"key":"X-Auth-Key","value":"","type":"text"}],"url":"https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier","urlObject":{"protocol":"https","path":["client","v4","zones",":zone_identifier","dns_records",":identifier"],"host":["api","cloudflare","com"],"query":[],"variable":[{"type":"string","value":"","key":"zone_identifier"},{"type":"string","value":"","key":"identifier"}]}},"response":[],"_postman_id":"41020414-012c-46bb-8409-54add428d12f"}],"event":[{"listen":"prerequest","script":{"id":"8b9534a2-5cff-4e41-8592-1383cb0f1b36","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"99468989-9396-450c-85a0-2a16b7de495e","type":"text/javascript","exec":[""]}}],"variable":[{"key":"domain","value":"sinao.fr"},{"key":"api_email","value":"quentin@sinao.fr"},{"key":"api_key","value":""},{"key":"zone_identifier","value":""},{"key":"recordToDelete","value":""}]}