arrow-left

All pages
1 of 1

Loading...

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 Primary 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 primary zone ID.

circle-check

Result: On a successful PUT request,

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

hashtag
Request

hashtag
Response

202 Successful operation

hashtag
Response Fields

Field
Type
Description
Example
If a record already exists but with a different configuration, the record is updated.

createdByUserId

string

The unique ID of the user who created the record

87f9a82e-b28d-49ed-9d04-fba2c0459cd3

lastModifiedDate

string

Record update timestamp

2022-08-21T15:52:53Z

lastModifiedBy

string

Unique name of the identity that created the record

ionos:iam:cloud:31960002:users/87f9a82e-b28d-49ed-9d04-fba2c0459cd3

lastModifiedByUserId

string

Unique ID of the user has last modified the record

63cef532-26fe-4a64-a4e0-de7c8a506c90

resourceURN

string

Unique name of the resource

ionos:<product>:<location>:<contract>:<resource-path>

zoneId

string

UUID of the primary 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

id

string

UUID of the newly created DNS record

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

createdDate

string

Record creation timestamp

2022-08-21T15:52:53Z

createdBy

string

Unique name of the identity that created the record

ionos:iam:cloud:31960002:users/87f9a82e-b28d-49ed-9d04-fba2c0459cd3

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
  }

}
{
  "id": "90d81ac0-3a30-44d4-95a5-12959effa6ee",
  "type": "record",
  "href": "<RESOURCE-URI>",
  "metadata": {
    "createdDate": "2022-08-21T15:52:53Z",
    "createdBy": "ionos:iam:cloud:31960002:users/87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "createdByUserId": "87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "lastModifiedDate": "2022-08-21T15:52:53Z",
    "lastModifiedBy": "ionos:iam:cloud:31960002:users/87f9a82e-b28d-49ed-9d04-fba2c0459cd3",
    "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
    "resourceURN": "ionos:<product>:<location>:<contract>:<resource-path>",
    "state": "PROVISIONING",
    "fqdn": "app.example.com",
    "zoneId": "a363f30c-4c0c-4552-9a07-298d87f219bf"
},
  },
  "properties": {
    "name": "app",
    "type": "A",
    "content": "192.0.2.2",
    "ttl": 3600,
    "priority": 3600,
    "enabled": true
  }
}