Get a list of views

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Views;
 2
 3$result = Views::getlist($client, array(
 4    "typeid" => 10001,
 5    "filter" => "select id from tm.view where createdts > (now() - INTERVAL '30 days')",
 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 = Views::getlist($client);

Response

 1object(Ticketmatic\Endpoints\Settings\System\ViewsList) (1) {
 2  ["data"]=>
 3  array(1) {
 4    [0]=>
 5    object(\Ticketmatic\Model\View) (9) {
 6      ["id"]=>
 7      int(0)
 8      ["typeid"]=>
 9      int(0)
10      ["name"]=>
11      string(9) "Base info"
12      ["columns"]=>
13      array(3) {
14        [0]=>
15        object(\Ticketmatic\Model\ViewColumn) (1) {
16          ["id"]=>
17          int(0)
18        }
19        [1]=>
20        object(\Ticketmatic\Model\ViewColumn) (1) {
21          ["id"]=>
22          int(0)
23        }
24        [2]=>
25        object(\Ticketmatic\Model\ViewColumn) (1) {
26          ["id"]=>
27          int(0)
28        }
29      }
30      ["orderby"]=>
31      int(0)
32      ["orderby_asc"]=>
33      bool(true)
34      ["isarchived"]=>
35      bool(false)
36      ["createdts"]=>
37      object(\DateTime) (3) {
38        ["date"]=>
39        string(26) "2014-09-26 15:24:36.000000"
40        ["timezone_type"]=>
41        int(3)
42        ["timezone"]=>
43        string(3) "UTC"
44      }
45      ["lastupdatets"]=>
46      object(\DateTime) (3) {
47        ["date"]=>
48        string(26) "2014-09-26 15:24:36.000000"
49        ["timezone_type"]=>
50        int(3)
51        ["timezone"]=>
52        string(3) "UTC"
53      }
54    }
55  }
56}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/views"
 4)
 5
 6result, err := views.Getlist(client, &ticketmatic.ViewQuery{
 7    Typeid: 10001,
 8    Filter: "select id from tm.view where createdts > (now() - INTERVAL '30 days')",
 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 := views.Getlist(client, nil)

Response

 1result := views.&List{
 2    Data: []*ticketmatic.View{
 3        &ticketmatic.View{
 4            Id: 123,
 5            Typeid: 10001,
 6            Name: "Base info",
 7            Columns: []*ticketmatic.ViewColumn{
 8                &ticketmatic.ViewColumn{
 9                    Id: 100,
10                },
11                &ticketmatic.ViewColumn{
12                    Id: 101,
13                },
14                &ticketmatic.ViewColumn{
15                    Id: 112,
16                },
17            },
18            Orderby: 102,
19            OrderbyAsc: true,
20            Isarchived: false,
21            Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
22            Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
23        },
24    },
25}

Request

1GET /api/1/{accountname}/settings/system/views 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            "name": "Base info",
10            "columns": [
11                {
12                    "id": 100
13                },
14                {
15                    "id": 101
16                },
17                {
18                    "id": 112
19                }
20            ],
21            "orderby": 102,
22            "orderby_asc": true,
23            "isarchived": false,
24            "createdts": "2014-09-26 15:24:36",
25            "lastupdatets": "2014-09-26 15:24:36"
26        }
27    ]
28}

Parameters

FieldDescription
typeid
required

Only return items with the given typeid.

Example value:10001
filter

Filter the returned items by specifying a query on the public datamodel that returns the ids.

Example value:"select id from tm.view where createdts > (now() - INTERVAL '30 days')"
includearchived

If this parameter is true, archived items will be returned as well.

Example value:true
lastupdatesince

All items that were updated since this timestamp will be returned. Timestamp should be passed in YYYY-MM-DD hh:mm:ss format.

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

Type reference: ViewQuery

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
name

Name of the view

Example value:"Base info"
columns

List of field definitions that are part of this view.

Example value:[ { "id": 100 }, { "id": 101 }, { "id": 112 } ]
orderby
int

The field definitions to order the results on.

Example value:102
orderby_asc
bool

Indicates whether the results should be ordered ascending or descending.

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