Question

What is the proper way to request "List All Domain Records" from the API?

Posted November 9, 2015 2.6k views
API

I’m using the following code (with my respective API key and domain) to make a request to get all domain records. The problem is that I don’t get back my domain records, instead, I get the Digital Ocean domain records. I have made other requests using my domain and API key and got back correct information. What part of this request is causing me to not get back my domain records?

This is my request:

curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer MY_API_KEY' "https://api.digitalocean.com/v2/domains/MYDOMAIN.com/records" 

This is my output:

{
    "domain_records": [
        {
            "id": 9663214,
            "type": "NS",
            "name": "@",
            "data": "ns1.digitalocean.com",
            "priority": null,
            "port": null,
            "weight": null
        },
        {
            "id": 9663215,
            "type": "NS",
            "name": "@",
            "data": "ns2.digitalocean.com",
            "priority": null,
            "port": null,
            "weight": null
        },
        {
            "id": 9663216,
            "type": "NS",
            "name": "@",
            "data": "ns3.digitalocean.com",
            "priority": null,
            "port": null,
            "weight": null
        },
        {
            "id": 9663217,
            "type": "A",
            "name": "@",
            "data": "159.203.105.142",
            "priority": null,
            "port": null,
            "weight": null
        },
        {
            "id": 9687584,
            "type": "MX",
            "name": "@",
            "data": "@",
            "priority": 5,
            "port": null,
            "weight": null
        }
    ],
    "links": {

    },
    "meta": {
        "total": 5
    }
}

1 comment
  • What I want is my domain (moshguy.com) and the sub-domains listed, like how I have it shown below. Like I said, I keep getting the domain records for digital ocean.

    {
        "domain_records": [
            {
                "id": 123456,
                "type": "NS",
                "name": "@",
                "data": "moshguy.com",
                "priority": null,
                "port": null,
                "weight": null
            },
            {
                "id": 123457,
                "type": "NS",
                "name": "@",
                "data": "subdomain1.moshguy.com",
                "priority": null,
                "port": null,
                "weight": null
            },
            {
                "id": 123458,
                "type": "NS",
                "name": "@",
                "data": "subdomain2.moshguy.com",
                "priority": null,
                "port": null,
                "weight": null
            }
        ],
        "links": {
    
        },
        "meta": {
            "total": 5
        }
    }
    
    

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

What is the domain and what records are you missing?

Submit an Answer