Update REST API documentation

Added relationships endpoint documentation.
This commit is contained in:
Markus Mäkelä 2017-10-23 13:28:19 +03:00
parent cd9a84d762
commit 0bfe89b86b
3 changed files with 145 additions and 0 deletions

View File

@ -298,6 +298,54 @@ Invalid request body:
`Status: 403 Forbidden`
### Update monitor relationships
```
PATCH /v1/monitors/:name/relationships/servers
```
The _:name_ in the URI must map to a monitor name with all whitespace replaced
with hyphens.
The request body must be a JSON object that defines only the _data_ field. The
value of the _data_ field must be an array of relationship objects that define
the _id_ and _type_ fields of the relationship. This object will replace the
existing relationships of the monitor.
The following is an example request and request body that defines a single
server relationship for a monitor.
```
PATCH /v1/monitors/my-monitor/relationships/servers
{
data: [
{ "id": "my-server", "type": "servers" }
]
}
```
All relationships for a monitor can be deleted by sending an empty array as the
_data_ field value. The following example removes all servers from a monitor.
```
PATCH /v1/monitors/my-monitor/relationships/servers
{
data: []
}
```
#### Response
Monitor relationships modified:
`Status: 204 No Content`
Invalid JSON body:
`Status: 403 Forbidden`
### Destroy a monitor
Destroy a created monitor. The monitor must not have relationships to any

View File

@ -467,6 +467,55 @@ Invalid JSON body:
`Status: 403 Forbidden`
### Update server relationships
```
PATCH /v1/servers/:name/relationships/:type
```
The _:name_ in the URI must map to a server name with all whitespace replaced
with hyphens. The _:type_ in the URI must be either _services_, for service
relationships, or _monitors_, for monitor relationships.
The request body must be a JSON object that defines only the _data_ field. The
value of the _data_ field must be an array of relationship objects that define
the _id_ and _type_ fields of the relationship. This object will replace the
existing relationships of the particular type from the server.
The following is an example request and request body that defines a single
service relationship for a server.
```
PATCH /v1/servers/my-db-server/relationships/services
{
data: [
{ "id": "my-rwsplit-service", "type": "services" }
]
}
```
All relationships for a server can be deleted by sending an empty array as the
_data_ field value. The following example removes the server from all services.
```
PATCH /v1/servers/my-db-server/relationships/services
{
data: []
}
```
#### Response
Server relationships modified:
`Status: 204 No Content`
Invalid JSON body:
`Status: 403 Forbidden`
### Destroy a server
```

View File

@ -420,6 +420,54 @@ Service is modified:
`Status: 204 No Content`
### Update service relationships
```
PATCH /v1/services/:name/relationships/servers
```
The _:name_ in the URI must map to a service name with all whitespace replaced
with hyphens.
The request body must be a JSON object that defines only the _data_ field. The
value of the _data_ field must be an array of relationship objects that define
the _id_ and _type_ fields of the relationship. This object will replace the
existing relationships of the service.
The following is an example request and request body that defines a single
server relationship for a service.
```
PATCH /v1/services/my-rw-service/relationships/servers
{
data: [
{ "id": "my-server", "type": "servers" }
]
}
```
All relationships for a service can be deleted by sending an empty array as the
_data_ field value. The following example removes all servers from a service.
```
PATCH /v1/services/my-rw-service/relationships/servers
{
data: []
}
```
#### Response
Service relationships modified:
`Status: 204 No Content`
Invalid JSON body:
`Status: 403 Forbidden`
### Stop a service
Stops a started service.