Perform PUT Request for Non-Existing Records

If you have an infrastructure that uses public DNS records and manage it by defining the required state, you can use Cloud DNS as follows:

  1. Create a DNS Zone with Cloud DNS.

  2. Generate a UUID (v3, v4, and v5 supported) for your DNS record.

  3. Add to your infrastructure a PUT call for the desired record configuration with your UUID and assign it to the corresponding DNS zone ID.

Result: On a successful PUT request,

  • If the record does not exist, Cloud DNS creates the record with the specified configuration.

  • If a record already exists but with a different configuration, the record is updated.

Request

curl --location  --request PUT 'https://dns.de-fra.ionos.com/zones/2a4428b3-dbe0-4357-9c02-609025b3a40f/records/90d81ac0-3a30-44d4-95a5-12959effa6ee' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJraWQiO' \
--header 'Content-Type: application/json' \
--data '{
   "properties": {
    "name": "app",
    "type": "A",
    "content": "192.0.2.2",
    "ttl": 3600,
    "enabled": true
  }

}

Response

202 Successful operation

{
  "id": "90d81ac0-3a30-44d4-95a5-12959effa6ee",
  "metadata": {
    "lastModifiedDate": "2022-08-21T15:52:53Z",
    "createdDate": "2022-08-21T15:52:53Z",
    "state": "CREATED",
    "fqdn": "app.example.com",
    "zoneId": "2a4428b3-dbe0-4357-9c02-609025b3a40f"
  },
  "properties": {
    "name": "app",
    "type": "A",
    "content": "192.0.2.2",
    "ttl": 3600,
    "enabled": true
  }
}

Response Fields

FieldTypeDescriptionExample

id

string

UUID of the newly created DNS record

90d81ac0-3a30-44d4-95a5-12959effa6ee

createdDate

string

DNS record creation timestamp

2023-03-15T09:58:59.147746133Z

lastModifiedDate

string

DNS record update timestamp

2023-03-15T09:58:59.147746133Z

zoneId

string

UUID of the DNS zone of the DNS record

2a4428b3-dbe0-4357-9c02-609025b3a40f

fqdn

string

Fully qualified domain name resulting from the record name and the zoneName

app.example.com

state

string

State of the request

CREATED

Last updated