Get a list of filter definitions
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::getlist($client, array(
4 "typeid" => 10001,
5 "filter" => "SELECT id FROM tm.filterdefinition WHERE filtertype=2",
6 "includearchived" => true,
7 "lastupdatesince" => "2014-09-26 15:24:36",
8));
9
10// The parameters array is optional, it can be omitted when empty.
11$result = Filterdefinitions::getlist($client);
Response
1object(Ticketmatic\Endpoints\Settings\System\FilterdefinitionsList) (1) {
2 ["data"]=>
3 array(1) {
4 [0]=>
5 object(\Ticketmatic\Model\FilterDefinition) (10) {
6 ["id"]=>
7 int(0)
8 ["typeid"]=>
9 int(0)
10 ["checklistquery"]=>
11 string(128) "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}"
12 ["description"]=>
13 string(13) "Sales channel"
14 ["filtertype"]=>
15 int(0)
16 ["sqlclause"]=>
17 string(53) "select id from tm.order where saleschannelid in ({0})"
18 ["visible"]=>
19 bool(true)
20 ["isarchived"]=>
21 bool(false)
22 ["createdts"]=>
23 object(\DateTime) (3) {
24 ["date"]=>
25 string(26) "2014-09-26 15:24:36.000000"
26 ["timezone_type"]=>
27 int(3)
28 ["timezone"]=>
29 string(3) "UTC"
30 }
31 ["lastupdatets"]=>
32 object(\DateTime) (3) {
33 ["date"]=>
34 string(26) "2014-09-26 15:24:36.000000"
35 ["timezone_type"]=>
36 int(3)
37 ["timezone"]=>
38 string(3) "UTC"
39 }
40 }
41 }
42}
Request
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/settings/system/filterdefinitions"
4)
5
6result, err := filterdefinitions.Getlist(client, &ticketmatic.FilterDefinitionQuery{
7 Typeid: 10001,
8 Filter: "SELECT id FROM tm.filterdefinition WHERE filtertype=2",
9 Includearchived: true,
10 Lastupdatesince: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
11})
12
13// The query object is optional, it can be omitted when empty.
14result, err := filterdefinitions.Getlist(client, nil)
Response
1result := filterdefinitions.&List{
2 Data: []*ticketmatic.FilterDefinition{
3 &ticketmatic.FilterDefinition{
4 Id: 123,
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 Isarchived: false,
12 Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
13 Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
14 },
15 },
16}
Request
1GET /api/1/{accountname}/settings/system/filterdefinitions HTTP/1.1
Response
1HTTP/1.1 200 OK
2Content-Type: application/json
3
4{
5 "data": [
6 {
7 "id": 123,
8 "typeid": 10001,
9 "checklistquery": "select id as ListBoxValue,name{0} as ListBoxDisplay from tm.saleschannel where isarchived is distinct from true order by name{0}",
10 "description": "Sales channel",
11 "filtertype": 2,
12 "sqlclause": "select id from tm.order where saleschannelid in ({0})",
13 "visible": true,
14 "isarchived": false,
15 "createdts": "2014-09-26 15:24:36",
16 "lastupdatets": "2014-09-26 15:24:36"
17 }
18 ]
19}
Parameters
Field | Description |
---|---|
typeid required | Only return items with the given typeid. Example value:10001 |
filter
|
Type reference: FilterDefinitionQuery
Result fields
This call returns an object with an array of objects in the data
field.
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[]