DNS Records

A DNSRecord is a custom DNS configuration record for a Site.

They represent the records you will need to configure in your DNS hosting provider to allow custom domains to work with Files.com.

Show Site DNS Configuration

SDK Method

dns_record.List()

Return Values

Returns a *dns_record.Iter and an error. Range over All() to receive files_sdk.DnsRecord values and errors. Check each loop error before using its resource. Next() and Err() remain supported.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    dns_record "github.com/Files-com/files-sdk-go/v3/dnsrecord"
)

dnsRecordIterator, err := dns_record.List(files_sdk.DnsRecordListParams{})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

for dnsRecord, err := range dnsRecordIterator.All() {
    if err != nil {
        var respErr files_sdk.ResponseError
        if errors.As(err, &respErr) {
            fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
        } else {
            fmt.Printf("Request failed: %v\n", err)
        }
        return
    }
    fmt.Println(dnsRecord)
}

The DnsRecord Object

Some of the methods above return a DnsRecord object. The attributes of this object are listed below.

AttributeDescription
Id
string
Unique label for DNS record; used by Zapier and other integrations.
Domain
string
DNS record domain name
Rrtype
string
DNS record type
Value
string
DNS record value