Modify an existing view

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Views;
 2
 3$result = Views::update($client, $id, array(
 4    "name" => "Base info",
 5    "columns" => array(
 6        array(
 7            "id" => 100,
 8        ),
 9        array(
10            "id" => 101,
11        ),
12        array(
13            "id" => 112,
14        ),
15    ),
16    "orderby" => 102,
17    "orderby_asc" => true,
18));

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.Update(client, id, &ticketmatic.View{
 7    Name: "Base info",
 8    Columns: []*ticketmatic.ViewColumn{
 9        &ticketmatic.ViewColumn{
10            Id: 100,
11        },
12        &ticketmatic.ViewColumn{
13            Id: 101,
14        },
15        &ticketmatic.ViewColumn{
16            Id: 112,
17        },
18    },
19    Orderby: 102,
20    OrderbyAsc: true,
21})

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

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

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