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.
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 |
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
resp = client.domains.list_records(domain_name="example.com")
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.
Unauthorized
The resource was not found.
API Rate limit exceeded
Server error.
Unexpected error