# 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. [<mark style="color:blue;">Create a Primary Zone</mark>](/cloud/network-services/cloud-dns/api-how-tos/create-primary-zone.md) 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.

{% hint style="success" %}
**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.
  {% endhint %}

## Request

```bash
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**

```json
{
  "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": "AVAILABLE",
    "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
  }
}
```

### Response Fields

| **Field**                | **Type** | **Description**                                                             | **Example**                                                         |
| ------------------------ | -------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| **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 |
| **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 who 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 record                                                         | AVAILABLE                                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/cloud/network-services/cloud-dns/api-how-tos/perform-put-request.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
