2

United Domains udag API

 1 year ago
source link: https://gist.github.com/bjuretko/abee8435c8d6f6de39a61322ad44699a
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Example

Install tidy and xmlstarlet

brew install tidy-html5
brew install xmlstarlet 

Login

EMAIL="[email protected]"
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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK