Create a new field definition

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Fielddefinitions;
 2
 3$result = Fielddefinitions::create($client, array(
 4    "typeid" => 10001,
 5    "align" => "left",
 6    "description" => "Created timestamp",
 7    "key" => "createdtimestamp",
 8    "sqlclause" => "tm.order.createdts",
 9    "uitype" => "number",
10    "variablewidth" => true,
11    "width" => 50,
12));

Response

 1object(\Ticketmatic\Model\FieldDefinition) (12) {
 2  ["id"]=>
 3  int(0)
 4  ["typeid"]=>
 5  int(0)
 6  ["align"]=>
 7  string(4) "left"
 8  ["description"]=>
 9  string(17) "Created timestamp"
10  ["key"]=>
11  string(16) "createdtimestamp"
12  ["sqlclause"]=>
13  string(18) "tm.order.createdts"
14  ["uitype"]=>
15  string(6) "number"
16  ["variablewidth"]=>
17  bool(true)
18  ["width"]=>
19  int(0)
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

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/fielddefinitions"
 4)
 5
 6result, err := fielddefinitions.Create(client, &ticketmatic.FieldDefinition{
 7    Typeid: 10001,
 8    Align: "left",
 9    Description: "Created timestamp",
10    Key: "createdtimestamp",
11    Sqlclause: "tm.order.createdts",
12    Uitype: "number",
13    Variablewidth: true,
14    Width: 50,
15})

Response

 1result := &ticketmatic.FieldDefinition{
 2    Id: 123,
 3    Typeid: 10001,
 4    Align: "left",
 5    Description: "Created timestamp",
 6    Key: "createdtimestamp",
 7    Sqlclause: "tm.order.createdts",
 8    Uitype: "number",
 9    Variablewidth: true,
10    Width: 50,
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}

Request

 1POST /api/1/{accountname}/settings/system/fielddefinitions HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 10001,
 6    "align": "left",
 7    "description": "Created timestamp",
 8    "key": "createdtimestamp",
 9    "sqlclause": "tm.order.createdts",
10    "uitype": "number",
11    "variablewidth": true,
12    "width": 50
13}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 123,
 6    "typeid": 10001,
 7    "align": "left",
 8    "description": "Created timestamp",
 9    "key": "createdtimestamp",
10    "sqlclause": "tm.order.createdts",
11    "uitype": "number",
12    "variablewidth": true,
13    "width": 50,
14    "isarchived": false,
15    "createdts": "2014-09-26 15:24:36",
16    "lastupdatets": "2014-09-26 15:24:36"
17}

Request body fields

FieldDescription
typeid
int 
(required)

Type ID

Example value:10001
align
string 
(required)

Alignment of the field definition, when used in a view. Values can be ‘left’, ‘right’ or ‘center’

Example value:"left"
description
mlstring 
(required)

Human-readable name for the field definition

Example value:"Created timestamp"
key
string 
(required)

Key for the field definition. Should only consist of lowercase alphanumeric characters

Example value:"createdtimestamp"
sqlclause
string 
(required)

The actual definition of the field definition. Contains the sql clause that will retrieve the information element in the database.

Example value:"tm.order.createdts"
uitype
string 
(required)

Will decide how the field will be rendered when used in a view.

Example value:"number"
variablewidth
bool 
(required)

Indicates whether the width for the field definition can be adapted when stretching a view that includes the field definition across the whole available width.

Example value:true
width
int 
(required)

Width of the field definition, when used in a view

Example value:50

Type reference: FieldDefinition

Result fields

FieldDescription
id
int

Unique ID

Example value:123
typeid
int

Type ID

Example value:10001
align
string

Alignment of the field definition, when used in a view. Values can be ‘left’, ‘right’ or ‘center’

Example value:"left"
description

Human-readable name for the field definition

Example value:"Created timestamp"
key
string

Key for the field definition. Should only consist of lowercase alphanumeric characters

Example value:"createdtimestamp"
sqlclause
string

The actual definition of the field definition. Contains the sql clause that will retrieve the information element in the database.

Example value:"tm.order.createdts"
uitype
string

Will decide how the field will be rendered when used in a view.

Example value:"number"
variablewidth
bool

Indicates whether the width for the field definition can be adapted when stretching a view that includes the field definition across the whole available width.

Example value:true
width
int

Width of the field definition, when used in a view

Example value:50
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: FieldDefinition