Create a new view

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::create($client, array(
 4    "typeid" => 10001,
 5    "name" => "Base info",
 6    "columns" => array(
 7        array(
 8            "id" => 100,
 9        ),
10        array(
11            "id" => 101,
12        ),
13        array(
14            "id" => 112,
15        ),
16    ),
17    "orderby" => 102,
18    "orderby_asc" => true,
19));

Response

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

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/views"
 4)
 5
 6result, err := views.Create(client, &ticketmatic.View{
 7    Typeid: 10001,
 8    Name: "Base info",
 9    Columns: []*ticketmatic.ViewColumn{
10        &ticketmatic.ViewColumn{
11            Id: 100,
12        },
13        &ticketmatic.ViewColumn{
14            Id: 101,
15        },
16        &ticketmatic.ViewColumn{
17            Id: 112,
18        },
19    },
20    Orderby: 102,
21    OrderbyAsc: true,
22})

Response

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

Request

 1POST /api/1/{accountname}/settings/system/views HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 10001,
 6    "name": "Base info",
 7    "columns": [
 8        {
 9            "id": 100
10        },
11        {
12            "id": 101
13        },
14        {
15            "id": 112
16        }
17    ],
18    "orderby": 102,
19    "orderby_asc": true
20}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 123,
 6    "typeid": 10001,
 7    "name": "Base info",
 8    "columns": [
 9        {
10            "id": 100
11        },
12        {
13            "id": 101
14        },
15        {
16            "id": 112
17        }
18    ],
19    "orderby": 102,
20    "orderby_asc": true,
21    "isarchived": false,
22    "createdts": "2014-09-26 15:24:36",
23    "lastupdatets": "2014-09-26 15:24:36"
24}

Request body fields

FieldDescription
typeid
int 
(required)

Type ID

Example value:10001
name
mlstring 
(required)

Name of the view

Example value:"Base info"
columns
ViewColumn[] 
(required)

List of field definitions that are part of this view.

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

The field definitions to order the results on.

Example value:102
orderby_asc
bool 
(required)

Indicates whether the results should be ordered ascending or descending.

Example value:true

Type reference: View

Result fields

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