Skip to content

Instantly share code, notes, and snippets.

@bjuretko
Last active January 30, 2024 19:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save bjuretko/abee8435c8d6f6de39a61322ad44699a to your computer and use it in GitHub Desktop.
Save bjuretko/abee8435c8d6f6de39a61322ad44699a to your computer and use it in GitHub Desktop.
United Domains udag API

Example

Install tidy and xmlstarlet

brew install tidy-html5
brew install xmlstarlet 

Login

EMAIL="name@example.com"
PASSWORD="mypassword"

CSRF=`curl -sS --cookie-jar cookies.txt https://www.united-domains.de/login | \
tidy -q -asxhtml --show-warnings no  | \
xmlstarlet sel  --html  -t -m '//*[@id="login-form-1"]' -m '*[@name="csrf"]' -v '@value'`

curl -sS --cookie cookies.txt --cookie-jar cookieapi.txt -d "csrf=$CSRF" -d "selector=login" --data-urlencode "email=$EMAIL" --data-urlencode "pwd=$PASSWORD" -d "loginBtn=Login" https://www.united-domains.de/login

Example to get a id of a subdomain

DOMAIN="mydomain.de"
SUBDOMAIN="apisubdomain"
DOMAINID=`curl -sS --cookie cookieapi.txt https://www.united-domains.de/pfapi/dns/domain-list | jq --compact-output --raw-output '.data[] | select(.domain=="$DOMAIN").id'`

SUBDOMAINID=`curl -sS --cookie cookieapi.txt https://www.united-domains.de/pfapi/dns/domain/$DOMAINID/records | jq --raw-output '.data.A[] | select(.sub_domain=="$SUBDOMAIN").id'`
echo $SUBDOMAINID

Example to modify or a subdomain

Get Domain List

GET https://www.united-domains.de/pfapi/domains

{"data":["domain.de",...]}

GET https://www.united-domains.de/pfapi/dns/domain-list

{
  "data": [
    {
      "id": "xxxx",
      "domain": "xxxxx.de",
      "configurable": true,
      "domain_lock_state": {
        "domain_locked": false,
        "email_locked": false
      }
    }
  ]
}

Get Subdomains

GET https://www.united-domains.de/pfapi/dns/domain/:id/subdomain-list

{"data":["subdomain.xxxx.de"]}

Get Domain Records

GET https://www.united-domains.de/pfapi/dns/domain/:id/records

{
  "data": {
    "A": [
      {
        "address": "1.2.3.4",
        "id": xxxxx,
        "filter_value": "domain.de",
        "ttl": 600,
        "type": "A",
        "standard_value": false,
        "sub_domain": "",
        "domain": "domain.de",
        "webspace": false,
        "udag_record_type": 5
      },
      {
        "address": "2.3.4.5",
        "id": xxxxx,
        "filter_value": "subdomain.domain.de",
        "ttl": 600,
        "type": "A",
        "standard_value": false,
        "sub_domain": "*.subdomain",
        "domain": "domain.de",
        "webspace": false,
        "udag_record_type": 5
      }
    ],
    "AAAA": [],
    "MX": [
      {
        "prio": 10,
        "mail_server": "mx00.udag.de",
        "id": xxxxx,
        "filter_value": "domain.de",
        "ttl": 3600,
        "type": "MX",
        "standard_value": true,
        "sub_domain": "",
        "domain": "domain.de",
        "webspace": false,
        "udag_record_type": 4
      },
    "TXT": [
      {
        "text": "k=rsa; p=xxxxx",
        "id": xxxxxx,
        "filter_value": "yyyy._domainkey.domain.de",
        "ttl": 600,
        "type": "TXT",
        "standard_value": false,
        "sub_domain": "yyyy._domainkey",
        "domain": "domain.de",
        "webspace": false,
        "udag_record_type": 5
      }
    ],
    "SRV": [],
    "CNAME": [
      {
        "target": "domain.de",
        "id": xxxxx,
        "filter_value": "www.domain.de",
        "ttl": 600,
        "type": "CNAME",
        "standard_value": false,
        "sub_domain": "www",
        "domain": "xxxxx.de",
        "webspace": false,
        "udag_record_type": 5
      }
    ],
    "NS": [],
    "CAA": [
      {
        "flag": 0,
        "tag": "issuewild",
        "value": "letsencrypt.org",
        "id": xxxxx,
        "filter_value": "domain.de",
        "ttl": 600,
        "type": "CAA",
        "standard_value": false,
        "sub_domain": "",
        "domain": "domain.de",
        "webspace": false,
        "udag_record_type": 5
      }
    ]
  }
}

Set Domain Record

PUT https://www.united-domains.de/pfapi/dns/domain/:id/records

Based on type (see (Get Domain Record)[#get_domain_record]) provide a appropriate record structure

{
  "record": {
    "id": null,
    "type": "A",
    "sub_domain": "new-subdomain",
    "domain": "domain.de",
    "ttl": 600,
    "filter_value": "",
    "standard_value": false,
    "address": "100.100.100.100",
    "webspace": false,
    "formId": "A0"
  },
  "domain_lock_state": {
    "domain_locked": false,
    "email_locked": false
  }
}

Download zonefile

GET https://www.united-domains.de/pfapi/dns/domain/:id/export

@DeX77
Copy link

DeX77 commented Mar 27, 2020

Seems like that doesn't work anymore :(

@Panakotta00
Copy link

Any update on this?

@Sinnohd
Copy link

Sinnohd commented Mar 14, 2021

Login procedure has changed.
It's discussed in this gist: https://gist.github.com/mueslo/9258f8b75fe942d36eea4a6d67019f81

@x4FF3
Copy link

x4FF3 commented Jul 21, 2023

Did anybody get a PUT to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment