Endre Ottem
Verified User
- Joined
- Jul 4, 2019
- Messages
- 13
Hi guys!
Like many others, I'm currently in the process of moving from cPanel to DirectAdmin. We have spent years developing our own admin and client area using API calls to cPanel. We are now in the process of rewriting them to work with DirectAdmin, but find some things missing in the API docs - and also some weird output, especially in the API for fetching, adding and updating DNS records.
When I fetch all DNS records for a domain, this is what I get:
The first A-record looks like this:
[A] => endretest=1.2.3.4
A is the key, while the value contains the pointer name (endretest) and the pointer value (1.2.3.4).
The subsequent A-records look like this:
[endretest2] => 1.2.3.5
[ftp] => 1.2.3.4
[mail] => 1.2.3.4
Here, the pointer name is the key (e.g. "endretest2") and the value is the pointer value (ip address).
Further down the list, it gets even weirder. After listing the A records, there's only two records left in the array:
key:
value:
key:
value:
I've tried using both:
and:
Can anyone explain the logic to me? Or is there some other commands that does this in a more logical way?
Also, I can't seem to find any docs for adding, updating or deleting records in the zone. Perhaps I'm not looking at the right place (the API docs are a bit "unstructured").
Like many others, I'm currently in the process of moving from cPanel to DirectAdmin. We have spent years developing our own admin and client area using API calls to cPanel. We are now in the process of rewriting them to work with DirectAdmin, but find some things missing in the API docs - and also some weird output, especially in the API for fetching, adding and updating DNS records.
When I fetch all DNS records for a domain, this is what I get:
Code:
Array
(
[A] => endretest=1.2.3.4
[endretest2] => 1.2.3.5
[ftp] => 1.2.3.4
[mail] => 1.2.3.4
[pop] => 1.2.3.4
[smtp] => 1.2.3.4
[www] => 1.2.3.4
[domainname_no_] => 1.2.3.4
NS=ns1.domainname.no.=domainname.no.
[ns2_domainname_no_] => domainname.no.
MX=mail=10
CNAME=
PTR=
TXT=domainname.no.="v=spf1 a mx ip4:1.2.3.4 ~all"
AAAA=
SRV=
SPF=
TLSA=
CAA=
DS=
)
The first A-record looks like this:
[A] => endretest=1.2.3.4
A is the key, while the value contains the pointer name (endretest) and the pointer value (1.2.3.4).
The subsequent A-records look like this:
[endretest2] => 1.2.3.5
[ftp] => 1.2.3.4
[mail] => 1.2.3.4
Here, the pointer name is the key (e.g. "endretest2") and the value is the pointer value (ip address).
Further down the list, it gets even weirder. After listing the A records, there's only two records left in the array:
key:
Code:
domainname_no_
Code:
1.2.3.4 NS=ns1.domainname.no.=domainname.no.
key:
Code:
ns2_domainname_no_
Code:
domainname.no. MX=mail=10 CNAME= PTR= TXT=domainname.no.="v=spf1 a mx ip4:1.2.3.4 ~all" AAAA= SRV= SPF= TLSA= CAA= DS=
I've tried using both:
Code:
/CMD_API_DNS_CONTROL?domain=domainname.no&info=yes&urlencoded=yes
and:
Code:
/CMD_API_DNS_ADMIN?domain=domainname.no&info=yes&urlencoded=yes
Can anyone explain the logic to me? Or is there some other commands that does this in a more logical way?
Also, I can't seem to find any docs for adding, updating or deleting records in the zone. Perhaps I'm not looking at the right place (the API docs are a bit "unstructured").