MXS-1929: Update REST API documentation for filters
Added the DELETE and clarified the POST documentation.
This commit is contained in:
@ -88,16 +88,29 @@ GET /v1/filters
|
|||||||
|
|
||||||
### Create a filter
|
### Create a filter
|
||||||
|
|
||||||
Create a new filter. The request body must define the `/data/id`
|
|
||||||
field with the name of the filter, the `/data/type` field with the
|
|
||||||
value of `filters` and the `/data/attributes/module` field with the
|
|
||||||
filter module for this filter. All of the filter parameters should
|
|
||||||
be defined at creation time.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
POST /v1/filters
|
POST /v1/filters
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Create a new filter. The posted object must define at
|
||||||
|
least the following fields.
|
||||||
|
|
||||||
|
* `data.id`
|
||||||
|
* Name of the filter
|
||||||
|
|
||||||
|
* `data.type`
|
||||||
|
* Type of the object, must be `filters`
|
||||||
|
|
||||||
|
* `data.atttributes.module`
|
||||||
|
* The filter module to use
|
||||||
|
|
||||||
|
All of the filter parameters should be defined at creation time in the
|
||||||
|
`data.atttributes.parameters` object.
|
||||||
|
|
||||||
|
As the service to filter relationship is ordered (filters are applied in the
|
||||||
|
order they are listed), filter to service relationships cannot be defined at
|
||||||
|
creation time.
|
||||||
|
|
||||||
The following example defines a request body which creates the new filter,
|
The following example defines a request body which creates the new filter,
|
||||||
_test-filter_, and assigns it to a service.
|
_test-filter_, and assigns it to a service.
|
||||||
|
|
||||||
@ -111,16 +124,6 @@ _test-filter_, and assigns it to a service.
|
|||||||
"parameters": { // Filter parameters
|
"parameters": { // Filter parameters
|
||||||
"filebase": "/tmp/qla.log"
|
"filebase": "/tmp/qla.log"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"relationships": { // List of services that use this filter
|
|
||||||
"services": {
|
|
||||||
"data": [ // This filter is used by one service
|
|
||||||
{
|
|
||||||
"id": "service-1",
|
|
||||||
"type": "services"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,3 +134,22 @@ _test-filter_, and assigns it to a service.
|
|||||||
Filter is created:
|
Filter is created:
|
||||||
|
|
||||||
`Status: 204 No Content`
|
`Status: 204 No Content`
|
||||||
|
|
||||||
|
### Destroy a filter
|
||||||
|
|
||||||
|
```
|
||||||
|
DELETE /v1/filters/:filter
|
||||||
|
```
|
||||||
|
|
||||||
|
The _:filter_ in the URI must map to the name of the filter to be destroyed.
|
||||||
|
|
||||||
|
A filter can only be destroyed if no service uses it. This means that the
|
||||||
|
`data.relationships` object for the filter must be empty. Note that the service
|
||||||
|
→ filter relationship cannot be modified from the filters resource and must be
|
||||||
|
done via the services resource.
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
Filter is destroyed:
|
||||||
|
|
||||||
|
`Status: 204 No Content`
|
||||||
|
Reference in New Issue
Block a user