API v2 domain update data

June 26, 2017 1.8k views
API Ubuntu 16.04

so i created bash script to update one single domain, and domain pings to my server, but it stopped working few days ago can you help me:

my script logs:

Machine IP:
Domain config: {"domain_record":{"id":XXXXXX,"type":"A","name":"XXXXXXXX","data":"","priority":null,"port":null,"ttl":3600,"weight":null}}
Update domain DNS required!
Domain Old Ip:
New Ip:
Response of Domain DNS update: {"id":"not_found","message":"The resource you were accessing could not be found."}

where is the issue? if worked i dont know, few days ago

1 Answer

As it says, “The resource you were accessing could not be found.”. Double check the ID.

  • Yes, I can read and I also compared thous id, and its compeleatly the same as in first response. It worked time ago, and i don`t think that domain id is not unique and floating id witch updates in one domain/sub-domain lifecycle

    there is my bash code:

    # Ubuntu package "jq" should be inststalled on machine
    ip=$(curl -ss ipinfo.io/ip)
    echo "Machine IP: $ip"
    token="XXXXXXX" // tocen form my account
    domain="XXXXXXX" // domain name (not sub)
    record="XXXXXX" // sub-domain id
    cdd=$(curl -ss GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" "https://api.digitalocean.com/v2/domains/$domain/records/$record")
    echo "Domain config: $cdd"
    doDomainIp=$(echo $cdd | jq '.domain_record.data' | tr -d '"')
    if [ "$ip" != "$doDomainIp" ]; then
        echo "Update domain DNS required!"
        echo "Domain Old Ip: $doDomainIp"
        echo "New Ip: $ip"
    call=$(curl -ss PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{"data":"'$ip'"}' "https://api.digitalocean.com/v2/domains/$domain/records/$record")
        echo "Response of Domain DNS update: $call"
        echo "Domain is setted up!"
        echo "Machine ip: $ip"
        echo "Domain ip: $doDomainIp"
    edited by asb
    • Show the output of list domains and stop hiding the ID and domain - they’re not private.

      • domain="domonk.com"

        and sub-domain name i preffeare to leave hidden form of it is like:

        and output of this bash script is in first post:

        edited by asb
        • If you insist the ID is correct and matches the account, contact support. But I doubt it.

Have another answer? Share your knowledge.