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
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/settings/system/filterdefinitions"
4)
5
6result, err := filterdefinitions.Create(client, &ticketmatic.FilterDefinition{
7 Typeid: 10001,
8 Checklistquery: "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}",
9 Description: "Sales channel",
10 Filtertype: 2,
11 Sqlclause: "select id from tm.order where saleschannelid in ({0})",
12 Visible: true,
13})
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 Visible: true,
9 Isarchived: false,
10 Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
11 Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
12}
Request
1POST /api/1/{accountname}/settings/system/filterdefinitions HTTP/1.1
2Content-Type: application/json
3
4{
5 "typeid": 10001,
6 "checklistquery": "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}",
7 "description": "Sales channel",
8 "filtertype": 2,
9 "sqlclause": "select id from tm.order where saleschannelid in ({0})",
10 "visible": true
11}
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 "visible": true,
12 "isarchived": false,
13 "createdts": "2014-09-26 15:24:36",
14 "lastupdatets": "2014-09-26 15:24:36"
15}
Request body fields
Field | Description |
---|---|
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
Field | Description |
---|---|
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