You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, great script thanks for writing it.
I need to automatically add dns records for new servers, but I was getting update failed error when running. Looking through the code and Cloudflares API guide it looks like the script can only update an existing record (it uses PUT), I added an if check to see if it's adding/updating then use either POST or PUT depending on the action.
I genuinely dont understand GIT to submit my changes back :) so I'll just put it below:
# Perform record update
api_dns_update=`${curl_command} -s -X PUT "${cf_api_url}/zones/${zone_id}/dns_records/${record_id}" -H "X-Auth-Email: ${cf_email}" -H "X-Auth-Key: ${cf_api_key}" -H "Content-Type: application/json" --data "{\"id\":\"${zone_id}\",\"type\":\"A\",\"name\":\"${record_name}\",\"content\":\"${WAN_addr}\"}"`
This script is great, but on Mac OSX updating a record was failing with the error below, even after I manually created the record on the cloudflare site: Record update failed. {"success":false,"errors":[{"code":7001,"message":"Method PUT not available for that URI."}],"messages":[],"result":null}
Updating this line has fixed the error and it's now working! Thanks @bighippo999 I've submitted a pull request to add this.
shimco
added a commit
to shimco/cf-ddns.sh
that referenced
this issue
Aug 4, 2018
Hi, great script thanks for writing it.
I need to automatically add dns records for new servers, but I was getting update failed error when running. Looking through the code and Cloudflares API guide it looks like the script can only update an existing record (it uses PUT), I added an if check to see if it's adding/updating then use either POST or PUT depending on the action.
I genuinely dont understand GIT to submit my changes back :) so I'll just put it below:
Changed to:
Thanks again for writing it, I hope this helps someone.
The text was updated successfully, but these errors were encountered: