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) (9) {
 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      ["isarchived"]=>
19      bool(false)
20      ["createdts"]=>
21      object(\DateTime) (3) {
22        ["date"]=>
23        string(26) "2014-09-26 15:24:36.000000"
24        ["timezone_type"]=>
25        int(3)
26        ["timezone"]=>
27        string(3) "UTC"
28      }
29      ["lastupdatets"]=>
30      object(\DateTime) (3) {
31        ["date"]=>
32        string(26) "2014-09-26 15:24:36.000000"
33        ["timezone_type"]=>
34        int(3)
35        ["timezone"]=>
36        string(3) "UTC"
37      }
38    }
39  }
40}

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            Isarchived: false,
11            Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
12            Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
13        },
14    },
15}

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            "isarchived": false,
14            "createdts": "2014-09-26 15:24:36",
15            "lastupdatets": "2014-09-26 15:24:36"
16        }
17    ]
18}

Parameters

FieldDescription
typeid
required

Only return items with the given typeid.

Example value:10001
filter
        </td>
        <td class="description">
            <p>Filter the returned items by specifying a query on the public datamodel that returns the ids.</p> 
            <strong>Example value:</strong><code>&#34;SELECT id FROM tm.filterdefinition WHERE filtertype=2&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">includearchived</div>
            
        </td>
        <td class="description">
            <p>If this parameter is true, archived items will be returned as well.</p> 
            <strong>Example value:</strong><code>true</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">lastupdatesince</div>
            
        </td>
        <td class="description">
            <p>All items that were updated since this timestamp will be returned. Timestamp should be passed in <code>YYYY-MM-DD hh:mm:ss</code> format.</p> 
            <strong>Example value:</strong><code>&#34;2014-09-26 15:24:36&#34;</code>
        </td>
    </tr>
</tbody>

Type reference: FilterDefinitionQuery

Result fields

This call returns an object with an array of objects in the data field.

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[]