Get a list of field definitions

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::getlist($client, array(
 4    "typeid" => 10001,
 5    "filter" => "select id from tm.fielddefinition 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 = Fielddefinitions::getlist($client);

Response

 1object(Ticketmatic\Endpoints\Settings\System\FielddefinitionsList) (1) {
 2  ["data"]=>
 3  array(1) {
 4    [0]=>
 5    object(\Ticketmatic\Model\FieldDefinition) (12) {
 6      ["id"]=>
 7      int(0)
 8      ["typeid"]=>
 9      int(0)
10      ["align"]=>
11      string(4) "left"
12      ["description"]=>
13      string(17) "Created timestamp"
14      ["key"]=>
15      string(16) "createdtimestamp"
16      ["sqlclause"]=>
17      string(18) "tm.order.createdts"
18      ["uitype"]=>
19      string(6) "number"
20      ["variablewidth"]=>
21      bool(true)
22      ["width"]=>
23      int(0)
24      ["isarchived"]=>
25      bool(false)
26      ["createdts"]=>
27      object(\DateTime) (3) {
28        ["date"]=>
29        string(26) "2014-09-26 15:24:36.000000"
30        ["timezone_type"]=>
31        int(3)
32        ["timezone"]=>
33        string(3) "UTC"
34      }
35      ["lastupdatets"]=>
36      object(\DateTime) (3) {
37        ["date"]=>
38        string(26) "2014-09-26 15:24:36.000000"
39        ["timezone_type"]=>
40        int(3)
41        ["timezone"]=>
42        string(3) "UTC"
43      }
44    }
45  }
46}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/fielddefinitions"
 4)
 5
 6result, err := fielddefinitions.Getlist(client, &ticketmatic.FieldDefinitionQuery{
 7    Typeid: 10001,
 8    Filter: "select id from tm.fielddefinition 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 := fielddefinitions.Getlist(client, nil)

Response

 1result := fielddefinitions.&List{
 2    Data: []*ticketmatic.FieldDefinition{
 3        &ticketmatic.FieldDefinition{
 4            Id: 123,
 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            Isarchived: false,
14            Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
15            Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
16        },
17    },
18}

Request

1GET /api/1/{accountname}/settings/system/fielddefinitions 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            "align": "left",
10            "description": "Created timestamp",
11            "key": "createdtimestamp",
12            "sqlclause": "tm.order.createdts",
13            "uitype": "number",
14            "variablewidth": true,
15            "width": 50,
16            "isarchived": false,
17            "createdts": "2014-09-26 15:24:36",
18            "lastupdatets": "2014-09-26 15:24:36"
19        }
20    ]
21}

Parameters

FieldDescription
typeid
        </td>
        <td class="description">
            <p>Only return items with the given typeid.</p> 
            <strong>Example value:</strong><code>10001</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">filter</div>
            
        </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.fielddefinition where createdts &gt; (now() - INTERVAL &#39;30 days&#39;)&#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: FieldDefinitionQuery

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