Creates a new filter.

Security Consideration

The query parameter of the request body takes a JSON-serialized query. Some query types (e.g., task queries) allow to specify EL expressions in their parameters and may therefore be abused for remote code execution. See the section on security considerations for custom code in the user guide for details.

Method

POST /filter/create

Parameters

Request Body

A JSON object with the following properties:

Name Type Description
resourceType String The resource type of the filter, e.g., Task
name String The name of the filter.
owner String The user id of the owner of the filter.
query Object A JSON object which corresponds to the JSON body of a REST query. I.e., a filter which has the resourceType Task must contain a query which is a valid task query (see Task).
properties Object A JSON object containing various properties of the filter. The properties are user defined and no required properties exist. Properties can be used to save the priority or the description of a filter.

Result

A JSON object corresponding to the Filter interface in the engine. Its properties are as follows:

Name Value Description
id String The id of the filter.
resourceType String The resource type of the filter, e.g., Task.
name String The name of the filter.
owner String The user id of the owner of the filter.
query Object The save query of the filter as JSON object.
properties Object The properties of the filter as JSON object.

Response codes

Code Media type Description
200 application/json Request successful.
400 application/json Filter was invalid. See Introduction for the error response format.
403 application/json The authenticated user is unauthorized to create a new filter. See the Introduction for the error response format.

Example

Request

POST /filter/create

Request Body:

{
  "resourceType": "Task",
  "name": "Accounting Tasks",
  "owner": "jonny1",
  "query": {
    "candidateGroup": "accounting"
  },
  "properties": {
    "color": "#3e4d2f",
    "description": "Tasks assigned to group accounting",
    "priority": 5
  }
}

Response

Status 200.

{
  "id": "aFilterId",
  "resourceType": "Task",
  "name": "Accounting Tasks",
  "owner": "jonny1",
  "query": {
    "candidateGroup": "accounting"
  },
  "properties": {
    "color": "#3e4d2f",
    "description": "Tasks assigned to group accounting",
    "priority": 5
  }
}

目录: