Updated on 2024-12-03 GMT+08:00

Modifying a Record Set

Function

Modify a record set.

URI

PUT /v2/zones/{zone_id}/recordsets/{recordset_id}

For details, see Table 1.
Table 1 Parameters in the URI

Parameter

Mandatory

Type

Description

zone_id

Yes

String

Zone ID

Obtain the private zone ID according to Querying Private Zones.

recordset_id

Yes

String

ID of the record set to be modified

You can obtain the value by calling the API in Querying Record Sets in a Zone.

Request

  • Parameter description
    Table 2 Parameters in the request

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Fully qualified domain name (FQDN) suffixed with a zone name, which is a complete host name ended with a dot

    If it is a record set in a public zone, you can add five labels at most.

    A domain name is case insensitive. Uppercase letters will also be converted into lowercase letters.

    description

    No

    String

    (Optional) Description of the domain name

    The value cannot exceed 255 characters.

    If this parameter is left blank, the value will not be changed.

    The value is left blank by default.

    type

    Yes

    String

    Record set type

    The value can be A, AAAA, MX, CNAME, TXT, SRV, or PTR.

    For details, see Record Set Type.

    ttl

    No

    Integer

    Record set cache duration (in seconds) on a local DNS server. The longer the duration is, the slower the update takes effect.

    If your service address is frequently changed, set TTL to a smaller value.

    Value range: 3002147483647

    If this parameter is left blank, the value will not be changed.

    The value is left blank by default.

    records

    No

    Array of strings

    Value of the record set. The value format varies depending on record set types.

    For example, the value of an AAAA record set is the IPv6 address list mapped to the domain name.

  • Example request

    Modify the record set whose ID is 2c9eb155587228570158722b6ac30007 in the zone whose ID is 2c9eb155587194ec01587224c9f90149:

    PUT https://{DNS_Endpoint}/v2/zones/2c9eb155587194ec01587224c9f90149/recordsets/2c9eb155587228570158722b6ac30007
    • A type
      {
         "name": "www.example.com.",
         "description": "This is an example record set.",
          "type": "A",
          "ttl": 3600,
          "records": [
              "192.168.10.1",
              "192.168.10.2"
          ]
      }
    • AAAA type
      {
          "name": "www.example.com.",
          "description": "This is an example record set.",
          "type": "AAAA",
          "ttl": 3600,
          "records": [
              "fe80:0:0:0:202:b3ff:fe1e:8329",
              "ff03:0db8:85a3:0:0:8a2e:0370:7334"
          ]
      }
    • MX type
      {
          "name": "www.example.com.",
          "description": "This is an example record set.",
          "type": "MX",
          "ttl": 3600,
          "records": [
              "1 mail.example.com"
          ]
      }
    • CNAME type
      {
          "name": "www.example.com.",
          "description": "This is an example record set.",
          "type": "CNAME",
          "ttl": 3600,
          "records": [
              "server1.example.com"
          ]
      }
    • TXT type
      {
          "name": "www.example.com.",
          "description": "This is an example record set.",
          "type": "TXT",
          "ttl": 300,
          "records": [
              "\"This host is used for sale.\""
          ]
      }
    • SRV type
      {
          "name": "www.example.com.",
          "description": "This is an example record set.",
          "type": "SRV",
          "ttl": 3600,
          "records": [
              "3 60 2176 sipserver.example.com.",
              "10 100 2176 sipserver.example.com."
          ]
      }
    • PTR type
      {
          "name": "www.example.com.",
          "description": "This is an example record set.",
          "type": "PTR",
          "ttl": 3600,
          "records": [
              "host.example.com."
      
          ]
      }
      

Response

  • Parameter description
    Table 3 Parameters in the response

    Parameter

    Type

    Description

    id

    String

    Record set ID

    name

    String

    Record set name

    description

    String

    Record set description

    zone_id

    String

    Zone ID of the record set

    zone_name

    String

    Zone name of the record set

    type

    String

    Record set type

    The value can be A, AAAA, MX, CNAME, TXT, SRV, or PTR.

    For details, see Record Set Type.

    ttl

    Integer

    Record set cache duration (in seconds) on a local DNS server. The longer the duration is, the slower the update takes effect.

    If your service address is frequently changed, set TTL to a smaller value.

    Value range: 3002147483647

    The default value is 300.

    records

    Array of strings

    Record set value

    create_at

    String

    Time when the record set was created

    The value format is yyyy-MM-dd'T'HH:mm:ss.SSS.

    update_at

    String

    Time when the record set was updated

    The value format is yyyy-MM-dd'T'HH:mm:ss.SSS.

    status

    String

    Resource status

    For details, see Resource Status.

    default

    Boolean

    Whether the record set is created by default. A default record set cannot be deleted.

    project_id

    String

    Project ID of the record set

    links

    Object

    Link to the current resource or other related resources. When a response is broken into pages, a next link is provided to retrieve all results.

    For details, see Table 4.

    Table 4 Parameters in the links field

    Parameter

    Type

    Description

    self

    String

    Link to the current resource

    next

    String

    Link to the next page

  • Example response
    {
        "id": "2c9eb155587228570158722b6ac30007",
        "name": "www.example.com.",
        "description": "This is an example record set.",
        "type": "A",
        "ttl": 3600,
        "records": [
            "192.168.10.1",
            "192.168.10.2"
        ],
        "status": "PENDING_UPDATE",
        "links": {
            "self": "https://Endpoint/v2/zones/2c9eb155587194ec01587224c9f90149/recordsets/2c9eb155587228570158722b6ac30007"
        },
        "zone_id": "2c9eb155587194ec01587224c9f90149",
        "zone_name": "example.com.",
        "create_at": "2016-11-17T12:03:17.827",
        "update_at": "2016-11-17T12:56:03.827",
        "default": false,
        "project_id": "e55c6f3dc4e34c9f86353b664ae0e70c"
    }

Returned Value

If a 2xx status code is returned, for example, 200, 202, or 204, the request is successful.

For details, see Status Code.