Get a list of custom fields

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Customfields;
 2
 3$result = Customfields::getlist($client, array(
 4    "typeid" => 13001,
 5    "filter" => "SELECT id FROM tm.customfield WHERE edittypeid=22002",
 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 = Customfields::getlist($client);

Response

 1object(Ticketmatic\Endpoints\Settings\System\CustomfieldsList) (1) {
 2  ["data"]=>
 3  array(1) {
 4    [0]=>
 5    object(\Ticketmatic\Model\CustomField) (13) {
 6      ["id"]=>
 7      int(0)
 8      ["typeid"]=>
 9      int(0)
10      ["availability"]=>
11      object(\Ticketmatic\Model\CustomfieldAvailability) (2) {
12        ["saleschannels"]=>
13        array(1) {
14          [0]=>
15          int(0)
16        }
17        ["usescript"]=>
18        bool(false)
19      }
20      ["caption"]=>
21      string(5) "Genre"
22      ["description"]=>
23      string(29) "Where have you heard from us?"
24      ["edittypeid"]=>
25      int(0)
26      ["fieldtypeid"]=>
27      int(0)
28      ["key"]=>
29      string(5) "genre"
30      ["manualsort"]=>
31      bool(false)
32      ["requiredtypeid"]=>
33      int(0)
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/customfields"
 4)
 5
 6result, err := customfields.Getlist(client, &ticketmatic.CustomFieldQuery{
 7    Typeid: 13001,
 8    Filter: "SELECT id FROM tm.customfield WHERE edittypeid=22002",
 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 := customfields.Getlist(client, nil)

Response

 1result := customfields.&List{
 2    Data: []*ticketmatic.CustomField{
 3        &ticketmatic.CustomField{
 4            Id: 123,
 5            Typeid: 13001,
 6            Availability: &ticketmatic.CustomfieldAvailability{
 7                Saleschannels: []int64{
 8                    14,
 9                },
10                Usescript: false,
11            },
12            Caption: "Genre",
13            Description: "Where have you heard from us?",
14            Edittypeid: 22002,
15            Fieldtypeid: 12001,
16            Key: "genre",
17            Manualsort: false,
18            Requiredtypeid: 30002,
19            Isarchived: false,
20            Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
21            Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
22        },
23    },
24}

Request

1GET /api/1/{accountname}/settings/system/customfields HTTP/1.1

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "data": [
 6        {
 7            "id": 123,
 8            "typeid": 13001,
 9            "availability": {
10                "saleschannels": [ 14 ],
11                "usescript": false
12            },
13            "caption": "Genre",
14            "description": "Where have you heard from us?",
15            "edittypeid": 22002,
16            "fieldtypeid": 12001,
17            "key": "genre",
18            "manualsort": false,
19            "requiredtypeid": 30002,
20            "isarchived": false,
21            "createdts": "2014-09-26 15:24:36",
22            "lastupdatets": "2014-09-26 15:24:36"
23        }
24    ]
25}

Parameters

FieldDescription
typeid
required

Only return items with the given typeid.

Example value:13001
filter
        </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.customfield WHERE edittypeid=22002&#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: CustomFieldQuery

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:13001
availability

Rules that define in what conditions this custom field is available when edit type is checkout

Example value:{ "saleschannels": [ 14 ], "usescript": false }
caption

Human-readable name for the custom field

Example value:"Genre"
description

Human-readable description for the custom field. Will be visible for end-users when edittype checkout is used

Example value:"Where have you heard from us?"
edittypeid
int

Type of editing that is allowed for the custom field. Links to systemtype category 22xxx

Example value:22002
fieldtypeid
int

Type of the custom field. Links to systemtype category 12xxx

Example value:12001
key
string

The identifier for the custom field. Should contain only alphanumeric characters and no whitespace, max length is 30 characters. The custom field will be available in the api and the public data model as c_

Example value:"genre"
manualsort
bool

Indicated whether the field is manually sortable

requiredtypeid
int

Indicates where the custom field is required. Links to systemtype category 30xxx

Example value:30002
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: CustomField[]