Modify an existing filter definition

Content

Resource URL

https://apps.ticketmatic.com/api/1/{accountname}/settings/system/filterdefinitions/{id}

Example

Request

1use Ticketmatic\Endpoints\Settings\System\Filterdefinitions;
2
3$result = Filterdefinitions::update($client, $id, array(
4    "checklistquery" => "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}",
5    "description" => "Sales channel",
6    "filtertype" => 2,
7    "sqlclause" => "select id from tm.order where saleschannelid in ({0})",
8));

Response

 1object(\Ticketmatic\Model\FilterDefinition) (9) {
 2  ["id"]=>
 3  int(0)
 4  ["typeid"]=>
 5  int(0)
 6  ["checklistquery"]=>
 7  string(128) "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}"
 8  ["description"]=>
 9  string(13) "Sales channel"
10  ["filtertype"]=>
11  int(0)
12  ["sqlclause"]=>
13  string(53) "select id from tm.order where saleschannelid in ({0})"
14  ["isarchived"]=>
15  bool(false)
16  ["createdts"]=>
17  object(\DateTime) (3) {
18    ["date"]=>
19    string(26) "2014-09-26 15:24:36.000000"
20    ["timezone_type"]=>
21    int(3)
22    ["timezone"]=>
23    string(3) "UTC"
24  }
25  ["lastupdatets"]=>
26  object(\DateTime) (3) {
27    ["date"]=>
28    string(26) "2014-09-26 15:24:36.000000"
29    ["timezone_type"]=>
30    int(3)
31    ["timezone"]=>
32    string(3) "UTC"
33  }
34}
35

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/filterdefinitions"
 4)
 5
 6result, err := filterdefinitions.Update(client, id, &ticketmatic.FilterDefinition{
 7    Checklistquery: "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}",
 8    Description: "Sales channel",
 9    Filtertype: 2,
10    Sqlclause: "select id from tm.order where saleschannelid in ({0})",
11})

Response

 1result := &ticketmatic.FilterDefinition{
 2    Id: 123,
 3    Typeid: 10001,
 4    Checklistquery: "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}",
 5    Description: "Sales channel",
 6    Filtertype: 2,
 7    Sqlclause: "select id from tm.order where saleschannelid in ({0})",
 8    Isarchived: false,
 9    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
10    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
11}

Request

1PUT /api/1/{accountname}/settings/system/filterdefinitions/{id} HTTP/1.1
2Content-Type: application/json
3
4{
5    "checklistquery": "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}",
6    "description": "Sales channel",
7    "filtertype": 2,
8    "sqlclause": "select id from tm.order where saleschannelid in ({0})"
9}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 123,
 6    "typeid": 10001,
 7    "checklistquery": "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}",
 8    "description": "Sales channel",
 9    "filtertype": 2,
10    "sqlclause": "select id from tm.order where saleschannelid in ({0})",
11    "isarchived": false,
12    "createdts": "2014-09-26 15:24:36",
13    "lastupdatets": "2014-09-26 15:24:36"
14}

Request body fields

FieldDescription
checklistquery
string 
(required)

For certain filter types, the user must select a value from a list. The checklistquery contains the sql clause to retrieve the list of available values.

Example value:"select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}"
description
mlstring 
(required)

Name for the filter

Example value:"Sales channel"
filtertype
int 
(required)

The type of filter definition defines the UI and resulting parameters that will be used when a user selects the filter. The possible values can be found here.

Example value:2
sqlclause
string 
(required)

The sql clause that defines how the filter will work

Example value:"select id from tm.order where saleschannelid in ({0})"

Type reference: FilterDefinition

Result fields

FieldDescription
id
int

Unique ID

Example value:123
typeid
int

Type ID

Example value:10001
checklistquery
string

For certain filter types, the user must select a value from a list. The checklistquery contains the sql clause to retrieve the list of available values.

Example value:"select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}"
description

Name for the filter

Example value:"Sales channel"
filtertype
int

The type of filter definition defines the UI and resulting parameters that will be used when a user selects the filter. The possible values can be found here.

Example value:2
sqlclause
string

The sql clause that defines how the filter will work

Example value:"select id from tm.order where saleschannelid in ({0})"
isarchived
bool

Whether or not this item is archived

createdts
timestamp

Created timestamp

Example value:"2014-09-26 15:24:36"
lastupdatets
timestamp

Last updated timestamp

Example value:"2014-09-26 15:24:36"

Type reference: FilterDefinition