Add name server API

#661
This commit is contained in:
Artur Beljajev 2018-02-22 12:44:24 +02:00
parent 1fe520261f
commit 69c32546de
5 changed files with 120 additions and 65 deletions

View file

@ -1,36 +1,42 @@
# Nameservers
## PUT /repp/v1/nameservers
Replaces nameservers
## PATCH /repp/v1/nameservers
Replaces all name servers of current registrar domains.
#### Request
```
PUT /repp/v1/nameservers
PATCH /repp/v1/nameservers
Accept: application/json
Content-Type: application/json
Authorization: Basic dGVzdDp0ZXN0dGVzdA==
{
"data":{
"nameservers":[
{
"hostname":"ns1.example.com",
"ipv4":"192.0.2.1"
"ipv6":"2001:DB8::1"
},
{
"hostname":"ns2.example.com",
"ipv4":"192.0.2.1"
"ipv6":"2001:DB8::1"
}
]
}
"data":{
"type": "nameserver",
"id": "ns1.example.com",
"attributes": {
"hostname": "new-ns1.example.com",
"ipv4": ["192.0.2.1", "192.0.2.2"],
"ipv6": ["2001:db8::1", "2001:db8::2"]
},
}
}
```
#### Response on success
```
HTTP/1.1 204
HTTP/1.1 200
Content-Type: application/json
{
"data":{
"type": "nameserver",
"id": "new-ns1.example.com",
"attributes": {
"hostname": "new-ns1.example.com",
"ipv4": ["192.0.2.1", "192.0.2.2"],
"ipv6": ["2001:db8::1", "2001:db8::2"]
},
}
}
```
#### Response on failure
@ -38,13 +44,13 @@ HTTP/1.1 204
HTTP/1.1 400
Content-Type: application/json
{
"errors":[
{
"title":"ns1.example.com does not exist"
},
{
"title":"192.0.2.1 is not a valid IPv4 address"
}
]
"errors":[
{
"title":"ns1.example.com does not exist"
},
{
"title":"192.0.2.1 is not a valid IPv4 address"
}
]
}
```