From 3de0847806784b0200f8b6c286d144a266556822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 17 Jul 2018 09:54:36 +0300 Subject: [PATCH] MXS-1929: Update REST API documentation for filters Added the creation of filter via the POST method. --- Documentation/REST-API/Resources-Filter.md | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Documentation/REST-API/Resources-Filter.md b/Documentation/REST-API/Resources-Filter.md index f2d7d9c08..fce391935 100644 --- a/Documentation/REST-API/Resources-Filter.md +++ b/Documentation/REST-API/Resources-Filter.md @@ -85,3 +85,49 @@ GET /v1/filters ] } ``` + +### 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 +``` + +The following example defines a request body which creates the new filter, +_test-filter_, and assigns it to a service. + +```javascript +{ + data: { + "id": "test-filter", // Name of the filter + "type": "filters", + "attributes": { + "module": "qlafilter", // The filter uses the qlafilter module + "parameters": { // Filter parameters + "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" + } + ] + } + } + } +} +``` + +#### Response + +Filter is created: + +`Status: 204 No Content`