Create a new custom field
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::create($client, array(
4 "typeid" => 13001,
5 "availability" => array(
6 "saleschannels" => array(
7 14,
8 ),
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));
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}
Request
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/settings/system/customfields"
4)
5
6result, err := customfields.Create(client, &ticketmatic.CustomField{
7 Typeid: 13001,
8 Availability: &ticketmatic.CustomfieldAvailability{
9 Saleschannels: []int64{
10 14,
11 },
12 Usescript: false,
13 },
14 Caption: "Genre",
15 Description: "Where have you heard from us?",
16 Edittypeid: 22002,
17 Fieldtypeid: 12001,
18 Key: "genre",
19 Manualsort: false,
20 Requiredtypeid: 30002,
21})
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
1POST /api/1/{accountname}/settings/system/customfields HTTP/1.1
2Content-Type: application/json
3
4{
5 "typeid": 13001,
6 "availability": {
7 "saleschannels": [ 14 ],
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
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
Field | Description |
---|---|
typeid int (required) | Type ID Example value:13001 |
availability CustomfieldAvailability (required) | Rules that define in what conditions this custom field is available when edit type is { "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 "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_ "genre" |
manualsort bool (required) | Indicated whether the field is manually sortable
|
Type reference: CustomField
Result fields
Field | Description |
---|---|
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 { "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 "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_ "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