Enviado em 19/09/2017 - 17:05h
Olá pessoal,
#!/bin/sh
auth_email="meu_email"
auth_key="minha_key"
zone_name="meudominio.com"
record_name="zonaaatualizar.meudominio.com"
zone_identifier=$(curl -k -s -X GET "https://api.cloudflare.com/client/v4/zones?name=$zone_name" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json" | cut -f 3 -d: | cut -f 1 -d, | sed 's/"//g')
record_identifier=$(curl -k -s -X GET "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records?name=$record_name" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json" | cut -f 3 -d: | cut -f 1 -d, | sed 's/"//g')
GETcloudflare=`/usr/local/bin/./curl -k -s -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records/$record_identifier" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json" --data "{\"id\":\"$zone_identifier\",\"type\":\"A\",\"name\":\"$record_name\",\"content\":\"$IPATUAL\"}"`
sendmail.sh $GETcloudflare
{"success":false,"errors":[{"code":7003,"message":"Could not route to \/zones\/dns_records, perhaps your object identifier is invalid?"},{"code":7000,"message":"No route for that URI"}],"messages":[],"result":null}
{"result":{"id":"xyz","type":"A","name":"zonaaatualizar.meudominio.com","content":"meu_IP_novo","proxiable":true,"proxied":false,"ttl":1,"locked":false,"zone_id":"xxxxxxxxxxxxx","zone_name":"meudominio.com","modified_on":"2017-09-19T19:51:39.603023Z","created_on":"2017-09-19T19:51:39.603023Z","meta":{"auto_added":false}},"success":true,"errors":[],"messages":[]}