updated api docs.

This commit is contained in:
Shreyas Zare
2021-03-06 17:50:08 +05:30
parent ac3cf0e35a
commit f54b572a85

View File

@@ -296,6 +296,7 @@ WHERE:
- `blockLists` (optional): Set to `true` to backup block lists cache files. Default value is `false`.
- `logs` (optional): Set to `true` to backup log files. Default value is `false`.
- `scopes` (optional): Set to `true` to backup DHCP scope files. Default value is `false`.
- `apps` (optional): Set to `true` to backup the installed DNS apps. Default value is `false`.
- `stats` (optional): Set to `true` to backup dashboard stats files. Default value is `false`.
- `zones` (optional): Set to `true` to backup DNS zone files. Default value is `false`.
- `allowedZones` (optional): Set to `true` to backup allowed zones file. Default value is `false`.
@@ -318,6 +319,7 @@ WHERE:
- `blockLists` (optional): Set to `true` to restore block lists cache files. Default value is `false`.
- `logs` (optional): Set to `true` to restore log files. Default value is `false`.
- `scopes` (optional): Set to `true` to restore DHCP scope files. Default value is `false`.
- `apps` (optional): Set to `true` to restore the DNS apps. Default value is `false`.
- `stats` (optional): Set to `true` to restore dashboard stats files. Default value is `false`.
- `zones` (optional): Set to `true` to restore DNS zone files. Default value is `false`.
- `allowedZones` (optional): Set to `true` to restore allowed zones file. Default value is `false`.
@@ -1758,10 +1760,13 @@ URL:
WHERE:
- `token`: The session token generated by the `login` call.
- `domain`: The domain name for creating new zone. The value can be valid domain name, an IP address, or an network address in CIDR format. When value is IP address or network address, a reverse zone is created.
- `type`: The type of zone to be created. Valid values are [`primary`, `secondary`, `stub`, `forwarder`].
- `type`: The type of zone to be created. Valid values are [`primary`, `secondary`, `stub`, `forwarder`, `application`].
- `primaryNameServerAddresses` (optional): List of comma separated IP addresses of the primary name server. This optional parameter is used only with Secondary and Stub zones. If this parameter is not used, the DNS server will try to recursively resolve the primary name server addresses automatically.
- `protocol` (optional): The DNS transport protocol to be used by the conditional forwarder zone. This optional parameter is used with Conditional Forwarder zones. Valid values are [`Udp`, `Tcp`, `Tls`, `Https`]. Default UDP protocol is used when this parameter is missing.
- `forwarder` (optional): The address of the DNS server to be used as a forwarder. This optional parameter is requred to be used with Conditional Forwarder zones. A special value `this-server` can be used as a forwarder which when used will forward all the requests internally to this DNS server such that you can override the zone with records and rest of the zone gets resolved via This Server.
- `appName` (optional): The name of the installed app to create the APP record. This optional parameter is required to be used with Application zones.
- `classPath` (optional): The class path to use for the selected app to create the APP record. This optional parameter is required to be used with Application zones.
- `recordData` (optional): The record data to use for the selected app to create the APP record. This optional parameter is required to be used with Application zones only when the DNS app requires it.
RESPONSE:
```
@@ -1840,8 +1845,8 @@ URL:
WHERE:
- `token`: The session token generated by the `login` call.
- `domain`: The domain name of the zone to add record.
- `type`: The DNS resource record type. Supported record types are [`A`, `AAAA`, `MX`, `TXT`, `NS`, `PTR`, `CNAME`, `SRV`, `CAA`] and proprietory types [`ANAME`, `FWD`].
- `value`: The value for the resource record. This parameter is shared among different types of resource records and thus will mean different values as per the type of record. Example, for type A and AAAA record, the value will be an IP address while for type MX, the value will be the exchange domain name and for type TXT the value will be the text data.
- `type`: The DNS resource record type. Supported record types are [`A`, `AAAA`, `MX`, `TXT`, `NS`, `PTR`, `CNAME`, `SRV`, `CAA`] and proprietory types [`ANAME`, `FWD`, `APP`].
- `value`: The value for the resource record. This parameter is shared among different types of resource records and thus will mean different values as per the type of record. Example, for type A and AAAA record, the value will be an IP address while for type MX, the value will be the exchange domain name and for type TXT the value will be the text data. The `APP` record uses this value as the app name.
- `ttl`: The DNS resource record TTL value. This is the value in seconds that the DNS resolvers can cache the record for.
- `ptr` (optional): Add a reverse PTR record for the IP address in the `A` or `AAAA` record. This option is used only for `A` and `AAAA` records.
- `createPtrZone` (optional): Create a reverse zone for PTR record. This option is used for `A` and `AAAA` records.
@@ -1853,6 +1858,8 @@ WHERE:
- `flags` (optional): This parameter is required for adding the `CAA` record.
- `tag` (optional): This parameter is required for adding the `CAA` record.
- `protocol` (optional): This parameter is required for adding the `FWD` record. Valid values are [`Udp`, `Tcp`, `Tls`, `Https`].
- `classPath` (optional): This parameter is required for adding the `APP` record.
- `recordData` (optional): This parameter is used for adding the `APP` record as per the DNS app requirements.
RESPONSE:
```
@@ -2030,6 +2037,151 @@ WHERE:
- `newFlags` (optional): This is the new value of the flags parameter in the CAA record. This parameter is used to update the flags parameter in the CAA record.
- `newTag` (optional): This is the new value of the tag parameter in the CAA record. This parameter is used to update the tag parameter in the CAA record.
- `protocol` (optional): This is the protocol parameter in the FWD record. Valid values are [`Udp`, `Tcp`, `Tls`, `Https`]. This parameter is optional and default value `Udp` will be used when updating the FWD record.
- `classPath` (optional): This parameter is required for updating the `APP` record.
- `recordData` (optional): This parameter is used for updating the `APP` record as per the DNS app requirements.
RESPONSE:
```
{
"response": {},
"status": "ok"
}
```
## DNS Apps API Calls
### List Apps
Lists all installed apps on the DNS server.
URL:
`http://localhost:5380/api/apps/list?token=x`
WHERE:
- `token`: The session token generated by the `login` call.
RESPONSE:
```
{
"response": {
"apps": [
{
"name": "Default",
"details": [
{
"classPath": "DefaultDnsApplication.GeoContinentAddress",
"description": "Returns A or AAAA records based on the continent the client queries from using MaxMind GeoIP2 Country database.",
"dataTemplate": "{\r\n \"EU\": [\r\n \"1.1.1.1\", \r\n \"2.2.2.2\"\r\n ],\r\n \"default\": [\r\n \"3.3.3.3\"\r\n ]\r\n}"
},
{
"classPath": "DefaultDnsApplication.GeoContinentCNAME",
"description": "Returns CNAME record based on the continent the client queries from using MaxMind GeoIP2 Country database. Note that the app will return ANAME record for an APP record at zone apex.",
"dataTemplate": "{\r\n \"EU\": \"eu.example.com\",\r\n \"default\": \"example.com\"\r\n}"
},
{
"classPath": "DefaultDnsApplication.GeoDistanceAddress",
"description": "Returns A or AAAA records of the server located geographically closest to the client using MaxMind GeoIP2 City database.",
"dataTemplate": "[\r\n {\r\n \"name\": \"server1-mumbai\",\r\n \"lat\": \"19.07283\",\r\n \"long\": \"72.88261\",\r\n \"addresses\": [\r\n \"1.1.1.1\"\r\n ]\r\n },\r\n {\r\n \"name\": \"server2-london\",\r\n \"lat\": \"51.50853\",\r\n \"long\": \"-0.12574\",\r\n \"addresses\": [\r\n \"2.2.2.2\"\r\n ]\r\n }\r\n]"
},
{
"classPath": "DefaultDnsApplication.GeoDistanceCNAME",
"description": "Returns CNAME record of the server located geographically closest to the client using MaxMind GeoIP2 City database. Note that the app will return ANAME record for an APP record at zone apex.",
"dataTemplate": "[\r\n {\r\n \"name\": \"server1-mumbai\",\r\n \"lat\": \"19.07283\",\r\n \"long\": \"72.88261\",\r\n \"cname\": \"mumbai.example.com\"\r\n },\r\n {\r\n \"name\": \"server2-london\",\r\n \"lat\": \"51.50853\",\r\n \"long\": \"-0.12574\",\r\n \"cname\": \"london.example.com\"\r\n }\r\n]"
},
{
"classPath": "DefaultDnsApplication.SimpleSplitHorizon",
"description": "Returns A or AAAA records with different set of IP addresses for clients querying over public and private networks.",
"dataTemplate": "{\r\n \"public\": [\r\n \"1.1.1.1\", \r\n \"2.2.2.2\"\r\n ],\r\n \"private\": [\r\n \"192.168.1.1\", \r\n \"::1\"\r\n ]\r\n}"
},
{
"classPath": "DefaultDnsApplication.WhatIsMyDns",
"description": "Returns the IP address of the user's DNS Server for A, AAAA, and TXT queries.",
"dataTemplate": null
}
]
}
]
},
"status": "ok"
}
```
### Install App
Installs a DNS application on the DNS server.
URL:
`http://localhost:5380/api/apps/install?token=x&name=app-name`
WHERE:
- `token`: The session token generated by the `login` call.
- `name`: The name of the app to install.
REQUEST: This is a POST request call where the request must be multi-part form data with the DNS application zip file data in binary format.
RESPONSE:
```
{
"response": {},
"status": "ok"
}
```
### Uninstall App
Uninstall an app from the DNS server. This does not remove any APP records that were using this DNS application.
URL:
`http://localhost:5380/api/apps/uninstall?token=x&name=app-name`
WHERE:
- `token`: The session token generated by the `login` call.
- `name`: The name of the app to uninstall.
RESPONSE:
```
{
"response": {},
"status": "ok"
}
```
### Get App Config
Retrieve the DNS application config from the `dnsApp.config` file in the application folder.
URL:
`http://localhost:5380/api/apps/getConfig?token=x&name=app-name`
WHERE:
- `token`: The session token generated by the `login` call.
- `name`: The name of the app to retrieve the config.
RESPONSE:
```
{
"response": {
"config": "config data or `null`"
},
"status": "ok"
}
```
### Set App Config
Saves the provided DNS application config into the `dnsApp.config` file in the application folder.
URL:
`http://localhost:5380/api/apps/setConfig?token=x&name=app-name`
WHERE:
- `token`: The session token generated by the `login` call.
- `name`: The name of the app to retrieve the config.
REQUEST: This is a POST request call where the content type of the request must be `application/x-www-form-urlencoded` and the content must be as shown below:
```
config=query-string-encoded-config-data
```
RESPONSE:
```