Custom Fields

Ticketmatic allows you to create custom fields on some data types. These fields can also be accessed through the API. Each custom field is added to the object it belongs to, with the key prefixed by c_.

For instance, a custom field named group will be added like this:

1{
2     "name": "Test",
3     "c_group": 123
4}

Library support

PHP

Each type that supports custom fields has an array property named custom_fields.

Each of the custom field values is added to this array (without the c_ prefix).

The example above looks like this in PHP:

1object(ObjectType)#1 (2) {
2  ["name"]=>
3  string(4) "Test"
4  ["custom_fields"]=>
5  array(1) {
6    ["group"]=>
7    int(123)
8  }
9}

Or in your code:

1$group = $myObj->custom_fields["group"];

Go

Each type that supports custom fields has a field named CustomFields, with a type of map[string]interface{}.

Each of the custom field values is added to this map (without the c_ prefix).

The example above looks like this in Go:

1ObjectType{
2    Name:         "Test",
3    CustomFields: map[string]interface {}{
4        "group": 123,
5    },
6}

Or in your code:

1group, ok := myObj.CustomFields["group"].(int)
2if !ok {
3    // Handle type mismatch
4}

We cannot supply the types for custom fields, so it is your own responsibility to do correct casting.