DNS Management ============== Index ----------------- DNS zone management resources: - [List of all zones](#zones) - [Get a zone detail](#zone) Record management resources: - [List of all records](#records) - [Get a record detail](#record) - [Create a new record](#post-record) - [Update a record](#put-record) - [Delete a record](#delete-record) List of all zones {#zones} -------------------- Available parameters: - `page` (int, not required) - `pagesize` (int, not required) Example of usage: add `?page=1&pagesize=20` to the end of the address. Default page size is unlimited. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/zone" -v -u key:signature -H "Date: request_date_time" ``` *if you don't know user ID of currently logged user, you can use string "self", i.e.: `https://rest.websupport.sk/v1/user/self/zone` >Request ```http GET https://rest.websupport.sk/v1/user/:id/zone HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 1, "name": "scaledo.com" }, { "id": 2, "name": "scaledo.co" }, ], "pager": { "page": 1, "pagesize": null, "items": 2 } } ``` Geting a zone {#zone} ----------- Get a zone detail by its domain name. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/zone/:domain_name" -v -u key:signature -H "Date: request_date_time" ``` *if you don't know user ID of currently logged user, you can use string "self", i.e.: `https://rest.websupport.sk/v1/user/self/zone/:domain_name` >Request ```http GET https://rest.websupport.sk/v1/user/:id/zone/:domain_name HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 1, "name": "scaledo.com", "updateTime": 1381169608 } ``` >Response `404` ```json { "code": 404, "message": "Zone not found" } ``` ---------------------------- List of all records {#records} -------------------- Available parameters: - `page` (int, not required) - `pagesize` (int, not required) >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record" -v -u key:signature -H "Date: request_date_time" ``` *if you don't know user ID of currently logged user, you can use string "self", i.e.: `https://rest.websupport.sk/v1/user/self/zone/:domain_name/record` >Request ```http GET https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "items": [ { "id": 1, "type": "A", "name": "@", "content": "37.9.169.99", "ttl": 600, "prio": null, "weight": null, "port": null }, { "id": 2, "type": "NS", "name": "@", "content": "ns1.scaledo.com", "ttl": 600, "prio": null, "weight": null, "port": null } ], "pager": { "page": 1, "pagesize": null, "items": 2 } } ``` >Response `404` ```json { "code": 404, "message": "Zone not found" } ``` Get a record {#record} ----------- Get a record detail by domain name and record id. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record/:id" -v -u key:signature -H "Date: request_date_time" ``` *if you don't know user ID of currently logged user, you can use string "self", i.e.: `https://rest.websupport.sk/v1/user/self/zone/:domain_name/record` >Request ```http GET https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record/:id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "id": 1, "type": "A", "name": "@", "content": "37.9.169.99", "ttl": 600, "prio": null, "weight": null, "port": null, "zone": { "id": 399, "name": "scaledo.com", "updateTime": 1381169608 } } ``` >Response `404` ```json { "code": 404, "message": "Record not found" } ``` Create a new record {#post-record} ----------- Supported record types are `A`, `AAAA`, `MX`, `ANAME`, `CNAME`, `NS`, `TXT` and `SRV`. #### Parameters for the **A** record: | Name | Type | Required | Comment | |---------|--------|----------|-----------------------------------------------------| | type | string | yes | value: `A` | | name | string | yes | subdomain name or `@` if you don't want subdomain | | content | string | yes | IPv4 address in dotted decimal format, i.e. `1.2.3.4` | | ttl | int | no | time to live, default 600 | #### Parameters for the **AAAA** record: | Name | Type | Required | Comment | |---------|--------|----------|---------------------------------------------------| | type | string | yes | value: `AAAA` | | name | string | yes | subdomain name or `@` if you don't want subdomain | | content | string | yes | IPv6 address ex. `2001:db8::3` | | ttl | int | no | time to live, default 600 | #### Parameters for the **MX** record: | Name | Type | Required | Comment | |---------|--------|----------|-----------------------------------------------------| | type | string | yes | value: `MX` | | name | string | yes | subdomain name or `@` if you don't want subdomain | | content | string | yes | domain name of mail servers, i.e. `mail1.scaledo.com` | | prio | int | yes | record priority | | ttl | int | no | time to live, default 600 | #### Parameters for the **ANAME** record: | Name | Type | Required | Comment | |---------|--------|----------|---------------------------------------------------| | type | string | yes | value: `ANAME` | | name | string | yes | value: `@` or empty string | | content | string | yes | the canonical hostname `something.scaledo.com` | | ttl | int | no | time to live, default 600 | #### Parameters for the **CNAME** record: | Name | Type | Required | Comment | |---------|--------|----------|---------------------------------------------------| | type | string | yes | value: `CNAME` | | name | string | yes | subdomain name | | content | string | yes | the canonical hostname `something.scaledo.com` | | ttl | int | no | time to live, default 600 | #### Parameters for the **NS** record: | Name | Type | Required | Comment | |---------|--------|----------|----------------------------------------------------------------| | type | string | yes | value: `NS` | | name | string | yes | subdomain name or `@` if you don't want subdomain | | content | string | yes | the canonical hostname of the DNS server, i.e. `ns1.scaledo.com` | | ttl | int | no | time to live, default 600 | #### Parameters for the **TXT** record: | Name | Type | Required | Comment | |---------|--------|----------|---------------------------------------------------| | type | string | yes | value: `TXT` | | name | string | yes | subdomain name or `@` if you don't want subdomain | | content | string | yes | text used for DKIM or other purposes | | ttl | int | no | time to live, default 600 | #### Parameters for the **SRV** record: | Name | Type | Required | Comment | |---------|--------|----------|-------------------------------------------------------------| | type | string | yes | value: `TXT` | | name | string | yes | subdomain name or `@` if you don't want subdomain | | content | string | yes | the canonical hostname of the machine providing the service | | prio | int | yes | record priority | | port | int | yes | the TCP or UDP port on which the service is to be found | | weight | int | yes | a relative weight for records with the same priority | | ttl | int | no | time to live, default 600 | *all changes are immediately reflected to our DNS servers, but records can be cached for a few minutes in your computer or in other DNS servers. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record" -H "Content-Type: application/json" -H "Date: request_date_time" \ -X POST -d '{"type":"A","name":"@","content": "1.2.3.4","ttl": 600}' -u key:signature ``` *if you don't know user ID of currently logged user, you can use string "self", i.e.: `https://rest.websupport.sk/v1/user/self/zone/:domain_name/record` >Request ```http POST https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record HTTP/1.1 Accept: application/json Content-Type: application/json { "type":"A", "name":"@", "content": "1.2.3.4", "ttl": 600 } ``` >Response `201` (success) ```json { "status": "success", "item": { "id": 4, "type": "A", "name": "@", "content": "1.2.3.4", "ttl": 600, "prio": null, "weight": null, "port": null, "zone": { "id": 1, "name": "scaledo.com", "updateTime": 1381169608 } }, "errors": [] } ``` >Response `400` (validation error) ```json { "status": "error", "item": { "id": null, "type": "A", "name": "something bad !@#$%^&*(", "content": "123.456.789.123", "ttl": 600, "prio": null, "weight": null, "port": null, "zone": { "id": 1, "name": "scaledo.com", "updateTime": 1381169608 } }, "errors": { "content": [ "Wrong IP address format" ], "name": [ "Invalid input." ] } } ``` >Response `404` ```json { "code": 404, "message": "Zone not found" } ``` Update a record {#put-record} ----------- The field `type` is **not allowed** here. You can't change the record type. All parameters are optional. Please refer to the [Create a new record](#post-record) resource for more parameter info. *all changes are immediately reflected to our DNS servers, but records can be cached for a few minutes in your computer or other DNS servers. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record/:id" -H "Content-Type: application/json" -H "Date: request_date_time" \ -X PUT -d '{"name":"@","content": "1.2.3.4","ttl": 600}' -u key:signature ``` *if you don't know user ID of currently logged user, you can use string "self", i.e.: `https://rest.websupport.sk/v1/user/self/zone/:domain_name/record/:id` >Request ```http PUT https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record/:id HTTP/1.1 Accept: application/json Content-Type: application/json { "name":"@", "content": "1.2.3.4", "ttl": 600 } ``` >Response `200` (success) ```json { "status": "success", "item": { "id": 4, "type": "A", "name": "@", "content": "1.2.3.4", "ttl": 600, "prio": null, "weight": null, "port": null, "zone": { "id": 1, "name": "scaledo.com", "updateTime": 1381169608 } }, "errors": [] } ``` >Response `400` (validation error) ```json { "status": "error", "item": { "id": null, "type": "A", "name": "something bad !@#$%^&*(", "content": "123.456.789.123", "ttl": 600, "prio": null, "weight": null, "port": null, "zone": { "id": 1, "name": "scaledo.com", "updateTime": 1381169608 } }, "errors": { "content": [ "Wrong IP address format" ], "name": [ "Invalid input." ] } } ``` >Response `404` ```json { "code": 404, "message": "Zone not found" } ``` Delete a record {#delete-record} ------------- No parameters required. *all changes are immediately reflected to our DNS servers, but records can be cached for a few minutes in your computer or other DNS servers. >Curl ```sh curl "https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record/:id" -X DELETE -u key:signature -H "Date: request_date_time" ``` *if you don't know user ID of currently logged user, you can use string "self", i.e.: `https://rest.websupport.sk/v1/user/self/zone/:domain_name/record/:id` >Request ```http DELETE https://rest.websupport.sk/v1/user/:id/zone/:domain_name/record/:id HTTP/1.1 Accept: application/json ``` >Response `200` ```json { "status": "success", "item": { "id": 1, "type": "A", "name": "@", "content": "1.2.3.4", "ttl": 600, "prio": null, "weight": null, "port": null, "zone": { "id": 1, "name": "scaledo.com", "updateTime": 1381316081 } }, "errors": [] } ``` >Response `404` ```json { "code": 404, "message": "Record not found" } ```