Create a new filter definition

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Filterdefinitions;
 2
 3$result = Filterdefinitions::create($client, array(
 4    "typeid" => 10001,
 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    "visible" => true,
10));

Response

 1object(\Ticketmatic\Model\FilterDefinition) (10) {
 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  ["visible"]=>
15  bool(true)
16  ["isarchived"]=>
17  bool(false)
18  ["createdts"]=>
19  object(\DateTime) (3) {
20    ["date"]=>
21    string(26) "2014-09-26 15:24:36.000000"
22    ["timezone_type"]=>
23    int(3)
24    ["timezone"]=>
25    string(3) "UTC"
26  }
27  ["lastupdatets"]=>
28  object(\DateTime) (3) {
29    ["date"]=>
30    string(26) "2014-09-26 15:24:36.000000"
31    ["timezone_type"]=>
32    int(3)
33    ["timezone"]=>
34    string(3) "UTC"
35  }
36}

Request body fields

FieldDescription
typeid
int 
(required)

Type ID

Example value:10001
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})"
visible
bool 
(required)

Disable or enable filter

Example value:true

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})"
visible
bool

Disable or enable filter

Example value:true
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