Modify an existing custom field

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Customfields;
 2
 3$result = Customfields::update($client, $id, array(
 4    "availability" => array(
 5        "saleschannels" => array(
 6            14,
 7        ),
 8        "usescript" => false,
 9    ),
10    "caption" => "Genre",
11    "description" => "Where have you heard from us?",
12    "edittypeid" => 22002,
13    "fieldtypeid" => 12001,
14    "key" => "genre",
15    "manualsort" => false,
16    "requiredtypeid" => 30002,
17));

Response

 1object(\Ticketmatic\Model\CustomField) (13) {
 2  ["id"]=>
 3  int(0)
 4  ["typeid"]=>
 5  int(0)
 6  ["availability"]=>
 7  object(\Ticketmatic\Model\CustomfieldAvailability) (2) {
 8    ["saleschannels"]=>
 9    array(1) {
10      [0]=>
11      int(0)
12    }
13    ["usescript"]=>
14    bool(false)
15  }
16  ["caption"]=>
17  string(5) "Genre"
18  ["description"]=>
19  string(29) "Where have you heard from us?"
20  ["edittypeid"]=>
21  int(0)
22  ["fieldtypeid"]=>
23  int(0)
24  ["key"]=>
25  string(5) "genre"
26  ["manualsort"]=>
27  bool(false)
28  ["requiredtypeid"]=>
29  int(0)
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}
51

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/customfields"
 4)
 5
 6result, err := customfields.Update(client, id, &ticketmatic.CustomField{
 7    Availability: &ticketmatic.CustomfieldAvailability{
 8        Saleschannels: []int64{
 9            14,
10        },
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})

Response

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

Request

 1PUT /api/1/{accountname}/settings/system/customfields/{id} HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "availability": {
 6        "saleschannels": [ 14 ],
 7        "usescript": false
 8    },
 9    "caption": "Genre",
10    "description": "Where have you heard from us?",
11    "edittypeid": 22002,
12    "fieldtypeid": 12001,
13    "key": "genre",
14    "manualsort": false,
15    "requiredtypeid": 30002
16}

Response

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

Request body fields

FieldDescription
availability

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

Example value:{ "saleschannels": [ 14 ], "usescript": false }
caption
mlstring 
(required)

Human-readable name for the custom field

Example value:"Genre"
description
mlstring 
(required)

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 
(required)

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

Example value:22002
fieldtypeid
int 
(required)

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

Example value:12001
key
string 
(required)

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 
(required)

Indicated whether the field is manually sortable

        </td>
    </tr><tr>
        <td class="field">
            <div class="name">requiredtypeid</div>
            <div class="type">int&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Indicates where the custom field is required. Links to systemtype category 30xxx</p> 
            <strong>Example value:</strong><code>30002</code>
        </td>
    </tr>
</tbody>

Type reference: CustomField

Result fields

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