pydo.domains.list_records()

Description

To get a listing of all records configured for a domain, send a GET request to /v2/domains/$DOMAIN_NAME/records. The list of records returned can be filtered by using the name and type query parameters. For example, to only include A records for a domain, send a GET request to /v2/domains/$DOMAIN_NAME/records?type=A. name must be a fully qualified record name. For example, to only include records matching sub.example.com, send a GET request to /v2/domains/$DOMAIN_NAME/records?name=sub.example.com. Both name and type may be used together.

Parameters

Name Type Required Description Default Value
domain_name string True The name of the domain itself.
name string False A fully qualified record name. For example, to only include records matching sub.example.com, send a GET request to /v2/domains/$DOMAIN_NAME/records?name=sub.example.com.
type string False The type of the DNS record. For example: A, CNAME, TXT, …
per_page integer False Number of items returned per page 20
page integer False Which ‘page’ of paginated results to return. 1

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

resp = client.domains.list_records(domain_name="example.com")

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

The response will be a JSON object with a key called domain_records. The value of this will be an array of domain record objects, each of which contains the standard domain record attributes. For attributes that are not used by a specific record type, a value of null will be returned. For instance, all records other than SRV will have null for the weight and port attributes.

Click to expand an example response for All Domain Records.
{
  "value": {
    "domain_records": [
      {
        "id": 28448429,
        "type": "NS",
        "name": "@",
        "data": "ns1.digitalocean.com",
        "priority": null,
        "port": null,
        "ttl": 1800,
        "weight": null,
        "flags": null,
        "tag": null
      },
      {
        "id": 28448430,
        "type": "NS",
        "name": "@",
        "data": "ns2.digitalocean.com",
        "priority": null,
        "port": null,
        "ttl": 1800,
        "weight": null,
        "flags": null,
        "tag": null
      },
      {
        "id": 28448431,
        "type": "NS",
        "name": "@",
        "data": "ns3.digitalocean.com",
        "priority": null,
        "port": null,
        "ttl": 1800,
        "weight": null,
        "flags": null,
        "tag": null
      },
      {
        "id": 28448432,
        "type": "A",
        "name": "@",
        "data": "1.2.3.4",
        "priority": null,
        "port": null,
        "ttl": 1800,
        "weight": null,
        "flags": null,
        "tag": null
      }
    ],
    "links": {},
    "meta": {
      "total": 4
    }
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

The resource was not found.

Click to expand an example response.
{
  "id": "not_found",
  "message": "The resource you requested could not be found."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}