Modify an existing product
Content
Resource URL
https://apps.ticketmatic.com/api/1/{accountname}/settings/products/{id}
Example
Request
1use Ticketmatic\Endpoints\Settings\Products;
2
3$result = Products::update($client, $id, array(
4 "categoryid" => 1,
5 "layoutid" => 1,
6 "name" => "T-shirt",
7 "code" => "123412341234",
8 "description" => "The new t-shirt is made of 100% cotton",
9 "groupbycustomfield" => 10003,
10 "instancevalues" => array(
11 "default" => array(
12 "price" => 25,
13 "voucher" => array(
14 "amount" => 10,
15 "voucherid" => 123,
16 ),
17 ),
18 "exceptions" => array(
19 array(
20 "properties" => array(
21 "colour" => array(
22 "red",
23 ),
24 "size" => array(
25 "S",
26 ),
27 ),
28 "value" => array(
29 "price" => 15,
30 "voucher" => array(
31 "amount" => 10,
32 "voucherid" => 123,
33 ),
34 ),
35 ),
36 array(
37 "properties" => array(
38 "colour" => array(
39 "red",
40 ),
41 "size" => array(
42 "M",
43 ),
44 ),
45 "value" => array(
46 "price" => 17,
47 "voucher" => array(
48 "amount" => 30,
49 "voucherid" => 124,
50 ),
51 ),
52 ),
53 ),
54 ),
55 "maxadditionaltickets" => 3,
56 "printtickets" => true,
57 "properties" => array(
58 array(
59 "name" => "Size",
60 "description" => "Size of the t-shirt",
61 "key" => "size",
62 "values" => array(
63 array(
64 "key" => "S",
65 "value" => "Small",
66 ),
67 array(
68 "key" => "M",
69 "value" => "Medium",
70 ),
71 array(
72 "key" => "L",
73 "value" => "Large",
74 ),
75 ),
76 ),
77 array(
78 "name" => "Colour",
79 "description" => "Colour of the t-shirt",
80 "key" => "colour",
81 "values" => array(
82 array(
83 "key" => "red",
84 "value" => "Red",
85 ),
86 array(
87 "key" => "green",
88 "value" => "Green",
89 ),
90 ),
91 ),
92 ),
93 "queuetoken" => 421,
94 "saleendts" => "2016-01-01 00:00:00",
95 "saleschannels" => array(
96 1,
97 2,
98 3,
99 ),
100 "salestartts" => "2016-01-01 00:00:00",
101 "translations" => array(
102 "properties:size:L:nl" => "Groot",
103 "properties:size:S:nl" => "Klein",
104 ),
105));
Response
1object(\Ticketmatic\Model\Product) (20) {
2 ["id"]=>
3 int(0)
4 ["typeid"]=>
5 int(0)
6 ["categoryid"]=>
7 int(0)
8 ["layoutid"]=>
9 int(0)
10 ["name"]=>
11 string(7) "T-shirt"
12 ["code"]=>
13 string(12) "123412341234"
14 ["description"]=>
15 string(38) "The new t-shirt is made of 100% cotton"
16 ["groupbycustomfield"]=>
17 int(0)
18 ["instancevalues"]=>
19 object(\Ticketmatic\Model\ProductInstancevalues) (2) {
20 ["default"]=>
21 object(\Ticketmatic\Model\ProductInstanceValue) (2) {
22 ["price"]=>
23 float(25.000000)
24 ["voucher"]=>
25 object(\Ticketmatic\Model\ProductVoucherValue) (2) {
26 ["amount"]=>
27 float(10.000000)
28 ["voucherid"]=>
29 int(0)
30 }
31 }
32 ["exceptions"]=>
33 array(2) {
34 [0]=>
35 object(\Ticketmatic\Model\ProductInstanceException) (2) {
36 ["properties"]=>
37 array(2) {
38 ["colour"]=>
39 array(1) {
40 [0]=>
41 string(3) "red"
42 }
43 ["size"]=>
44 array(1) {
45 [0]=>
46 string(1) "S"
47 }
48 }
49 ["value"]=>
50 object(\Ticketmatic\Model\ProductInstanceValue) (2) {
51 ["price"]=>
52 float(15.000000)
53 ["voucher"]=>
54 object(\Ticketmatic\Model\ProductVoucherValue) (2) {
55 ["amount"]=>
56 float(10.000000)
57 ["voucherid"]=>
58 int(0)
59 }
60 }
61 }
62 [1]=>
63 object(\Ticketmatic\Model\ProductInstanceException) (2) {
64 ["properties"]=>
65 array(2) {
66 ["colour"]=>
67 array(1) {
68 [0]=>
69 string(3) "red"
70 }
71 ["size"]=>
72 array(1) {
73 [0]=>
74 string(1) "M"
75 }
76 }
77 ["value"]=>
78 object(\Ticketmatic\Model\ProductInstanceValue) (2) {
79 ["price"]=>
80 float(17.000000)
81 ["voucher"]=>
82 object(\Ticketmatic\Model\ProductVoucherValue) (2) {
83 ["amount"]=>
84 float(30.000000)
85 ["voucherid"]=>
86 int(0)
87 }
88 }
89 }
90 }
91 }
92 ["maxadditionaltickets"]=>
93 int(0)
94 ["printtickets"]=>
95 bool(true)
96 ["properties"]=>
97 array(2) {
98 [0]=>
99 object(\Ticketmatic\Model\ProductProperty) (4) {
100 ["name"]=>
101 string(4) "Size"
102 ["description"]=>
103 string(19) "Size of the t-shirt"
104 ["key"]=>
105 string(4) "size"
106 ["values"]=>
107 array(3) {
108 [0]=>
109 object(\Ticketmatic\Model\KeyValueItem) (2) {
110 ["key"]=>
111 string(1) "S"
112 ["value"]=>
113 string(5) "Small"
114 }
115 [1]=>
116 object(\Ticketmatic\Model\KeyValueItem) (2) {
117 ["key"]=>
118 string(1) "M"
119 ["value"]=>
120 string(6) "Medium"
121 }
122 [2]=>
123 object(\Ticketmatic\Model\KeyValueItem) (2) {
124 ["key"]=>
125 string(1) "L"
126 ["value"]=>
127 string(5) "Large"
128 }
129 }
130 }
131 [1]=>
132 object(\Ticketmatic\Model\ProductProperty) (4) {
133 ["name"]=>
134 string(6) "Colour"
135 ["description"]=>
136 string(21) "Colour of the t-shirt"
137 ["key"]=>
138 string(6) "colour"
139 ["values"]=>
140 array(2) {
141 [0]=>
142 object(\Ticketmatic\Model\KeyValueItem) (2) {
143 ["key"]=>
144 string(3) "red"
145 ["value"]=>
146 string(3) "Red"
147 }
148 [1]=>
149 object(\Ticketmatic\Model\KeyValueItem) (2) {
150 ["key"]=>
151 string(5) "green"
152 ["value"]=>
153 string(5) "Green"
154 }
155 }
156 }
157 }
158 ["queuetoken"]=>
159 int(0)
160 ["saleendts"]=>
161 object(\DateTime) (3) {
162 ["date"]=>
163 string(26) "2016-01-01 00:00:00.000000"
164 ["timezone_type"]=>
165 int(3)
166 ["timezone"]=>
167 string(3) "UTC"
168 }
169 ["saleschannels"]=>
170 array(3) {
171 [0]=>
172 int(0)
173 [1]=>
174 int(0)
175 [2]=>
176 int(0)
177 }
178 ["salestartts"]=>
179 object(\DateTime) (3) {
180 ["date"]=>
181 string(26) "2016-01-01 00:00:00.000000"
182 ["timezone_type"]=>
183 int(3)
184 ["timezone"]=>
185 string(3) "UTC"
186 }
187 ["translations"]=>
188 array(2) {
189 ["properties:size:L:nl"]=>
190 string(5) "Groot"
191 ["properties:size:S:nl"]=>
192 string(5) "Klein"
193 }
194 ["isarchived"]=>
195 bool(false)
196 ["createdts"]=>
197 object(\DateTime) (3) {
198 ["date"]=>
199 string(26) "2014-09-26 15:24:36.000000"
200 ["timezone_type"]=>
201 int(3)
202 ["timezone"]=>
203 string(3) "UTC"
204 }
205 ["lastupdatets"]=>
206 object(\DateTime) (3) {
207 ["date"]=>
208 string(26) "2014-09-26 15:24:36.000000"
209 ["timezone_type"]=>
210 int(3)
211 ["timezone"]=>
212 string(3) "UTC"
213 }
214}
215
Request
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/settings/products"
4)
5
6result, err := products.Update(client, id, &ticketmatic.Product{
7 Categoryid: 1,
8 Layoutid: 1,
9 Name: "T-shirt",
10 Code: "123412341234",
11 Description: "The new t-shirt is made of 100% cotton",
12 Groupbycustomfield: 10003,
13 Instancevalues: &ticketmatic.ProductInstancevalues{
14 Default: &ticketmatic.ProductInstanceValue{
15 Price: 25,
16 Voucher: &ticketmatic.ProductVoucherValue{
17 Amount: 10,
18 Voucherid: 123,
19 },
20 },
21 Exceptions: []*ticketmatic.ProductInstanceException{
22 &ticketmatic.ProductInstanceException{
23 Properties: map[string][]string{
24 "colour": []string{
25 "red",
26 },
27 "size": []string{
28 "S",
29 },
30 },
31 Value: &ticketmatic.ProductInstanceValue{
32 Price: 15,
33 Voucher: &ticketmatic.ProductVoucherValue{
34 Amount: 10,
35 Voucherid: 123,
36 },
37 },
38 },
39 &ticketmatic.ProductInstanceException{
40 Properties: map[string][]string{
41 "colour": []string{
42 "red",
43 },
44 "size": []string{
45 "M",
46 },
47 },
48 Value: &ticketmatic.ProductInstanceValue{
49 Price: 17,
50 Voucher: &ticketmatic.ProductVoucherValue{
51 Amount: 30,
52 Voucherid: 124,
53 },
54 },
55 },
56 },
57 },
58 Maxadditionaltickets: 3,
59 Printtickets: true,
60 Properties: []*ticketmatic.ProductProperty{
61 &ticketmatic.ProductProperty{
62 Name: "Size",
63 Description: "Size of the t-shirt",
64 Key: "size",
65 Values: []*ticketmatic.KeyValueItem{
66 &ticketmatic.KeyValueItem{
67 Key: "S",
68 Value: "Small",
69 },
70 &ticketmatic.KeyValueItem{
71 Key: "M",
72 Value: "Medium",
73 },
74 &ticketmatic.KeyValueItem{
75 Key: "L",
76 Value: "Large",
77 },
78 },
79 },
80 &ticketmatic.ProductProperty{
81 Name: "Colour",
82 Description: "Colour of the t-shirt",
83 Key: "colour",
84 Values: []*ticketmatic.KeyValueItem{
85 &ticketmatic.KeyValueItem{
86 Key: "red",
87 Value: "Red",
88 },
89 &ticketmatic.KeyValueItem{
90 Key: "green",
91 Value: "Green",
92 },
93 },
94 },
95 },
96 Queuetoken: 421,
97 Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2016-01-01 00:00:00")),
98 Saleschannels: []int64{
99 1,
100 2,
101 3,
102 },
103 Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2016-01-01 00:00:00")),
104 Translations: map[string]string{
105 "properties:size:L:nl": "Groot",
106 "properties:size:S:nl": "Klein",
107 },
108})
Response
1result := &ticketmatic.Product{
2 Id: 123,
3 Typeid: 26001,
4 Categoryid: 1,
5 Layoutid: 1,
6 Name: "T-shirt",
7 Code: "123412341234",
8 Description: "The new t-shirt is made of 100% cotton",
9 Groupbycustomfield: 10003,
10 Instancevalues: &ticketmatic.ProductInstancevalues{
11 Default: &ticketmatic.ProductInstanceValue{
12 Price: 25,
13 Voucher: &ticketmatic.ProductVoucherValue{
14 Amount: 10,
15 Voucherid: 123,
16 },
17 },
18 Exceptions: []*ticketmatic.ProductInstanceException{
19 &ticketmatic.ProductInstanceException{
20 Properties: map[string][]string{
21 "colour": []string{
22 "red",
23 },
24 "size": []string{
25 "S",
26 },
27 },
28 Value: &ticketmatic.ProductInstanceValue{
29 Price: 15,
30 Voucher: &ticketmatic.ProductVoucherValue{
31 Amount: 10,
32 Voucherid: 123,
33 },
34 },
35 },
36 &ticketmatic.ProductInstanceException{
37 Properties: map[string][]string{
38 "colour": []string{
39 "red",
40 },
41 "size": []string{
42 "M",
43 },
44 },
45 Value: &ticketmatic.ProductInstanceValue{
46 Price: 17,
47 Voucher: &ticketmatic.ProductVoucherValue{
48 Amount: 30,
49 Voucherid: 124,
50 },
51 },
52 },
53 },
54 },
55 Maxadditionaltickets: 3,
56 Printtickets: true,
57 Properties: []*ticketmatic.ProductProperty{
58 &ticketmatic.ProductProperty{
59 Name: "Size",
60 Description: "Size of the t-shirt",
61 Key: "size",
62 Values: []*ticketmatic.KeyValueItem{
63 &ticketmatic.KeyValueItem{
64 Key: "S",
65 Value: "Small",
66 },
67 &ticketmatic.KeyValueItem{
68 Key: "M",
69 Value: "Medium",
70 },
71 &ticketmatic.KeyValueItem{
72 Key: "L",
73 Value: "Large",
74 },
75 },
76 },
77 &ticketmatic.ProductProperty{
78 Name: "Colour",
79 Description: "Colour of the t-shirt",
80 Key: "colour",
81 Values: []*ticketmatic.KeyValueItem{
82 &ticketmatic.KeyValueItem{
83 Key: "red",
84 Value: "Red",
85 },
86 &ticketmatic.KeyValueItem{
87 Key: "green",
88 Value: "Green",
89 },
90 },
91 },
92 },
93 Queuetoken: 421,
94 Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2016-01-01 00:00:00")),
95 Saleschannels: []int64{
96 1,
97 2,
98 3,
99 },
100 Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2016-01-01 00:00:00")),
101 Translations: map[string]string{
102 "properties:size:L:nl": "Groot",
103 "properties:size:S:nl": "Klein",
104 },
105 Isarchived: false,
106 Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
107 Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
108}
Request
1PUT /api/1/{accountname}/settings/products/{id} HTTP/1.1
2Content-Type: application/json
3
4{
5 "categoryid": 1,
6 "layoutid": 1,
7 "name": "T-shirt",
8 "code": "123412341234",
9 "description": "The new t-shirt is made of 100% cotton",
10 "groupbycustomfield": 10003,
11 "instancevalues": {
12 "default": {
13 "price": 25.000000,
14 "voucher": {
15 "amount": 10.000000,
16 "voucherid": 123
17 }
18 },
19 "exceptions": [
20 {
21 "properties": {
22 "colour": [
23 "red"
24 ],
25 "size": [
26 "S"
27 ]
28 },
29 "value": {
30 "price": 15.000000,
31 "voucher": {
32 "amount": 10.000000,
33 "voucherid": 123
34 }
35 }
36 },
37 {
38 "properties": {
39 "colour": [
40 "red"
41 ],
42 "size": [
43 "M"
44 ]
45 },
46 "value": {
47 "price": 17.000000,
48 "voucher": {
49 "amount": 30.000000,
50 "voucherid": 124
51 }
52 }
53 }
54 ]
55 },
56 "maxadditionaltickets": 3,
57 "printtickets": true,
58 "properties": [
59 {
60 "name": "Size",
61 "description": "Size of the t-shirt",
62 "key": "size",
63 "values": [
64 {
65 "key": "S",
66 "value": "Small"
67 },
68 {
69 "key": "M",
70 "value": "Medium"
71 },
72 {
73 "key": "L",
74 "value": "Large"
75 }
76 ]
77 },
78 {
79 "name": "Colour",
80 "description": "Colour of the t-shirt",
81 "key": "colour",
82 "values": [
83 {
84 "key": "red",
85 "value": "Red"
86 },
87 {
88 "key": "green",
89 "value": "Green"
90 }
91 ]
92 }
93 ],
94 "queuetoken": 421,
95 "saleendts": "2016-01-01 00:00:00",
96 "saleschannels": [ 1, 2, 3 ],
97 "salestartts": "2016-01-01 00:00:00",
98 "translations": {
99 "properties:size:L:nl": "Groot",
100 "properties:size:S:nl": "Klein"
101 }
102}
Response
1HTTP/1.1 200 OK
2Content-Type: application/json
3
4{
5 "id": 123,
6 "typeid": 26001,
7 "categoryid": 1,
8 "layoutid": 1,
9 "name": "T-shirt",
10 "code": "123412341234",
11 "description": "The new t-shirt is made of 100% cotton",
12 "groupbycustomfield": 10003,
13 "instancevalues": {
14 "default": {
15 "price": 25.000000,
16 "voucher": {
17 "amount": 10.000000,
18 "voucherid": 123
19 }
20 },
21 "exceptions": [
22 {
23 "properties": {
24 "colour": [
25 "red"
26 ],
27 "size": [
28 "S"
29 ]
30 },
31 "value": {
32 "price": 15.000000,
33 "voucher": {
34 "amount": 10.000000,
35 "voucherid": 123
36 }
37 }
38 },
39 {
40 "properties": {
41 "colour": [
42 "red"
43 ],
44 "size": [
45 "M"
46 ]
47 },
48 "value": {
49 "price": 17.000000,
50 "voucher": {
51 "amount": 30.000000,
52 "voucherid": 124
53 }
54 }
55 }
56 ]
57 },
58 "maxadditionaltickets": 3,
59 "printtickets": true,
60 "properties": [
61 {
62 "name": "Size",
63 "description": "Size of the t-shirt",
64 "key": "size",
65 "values": [
66 {
67 "key": "S",
68 "value": "Small"
69 },
70 {
71 "key": "M",
72 "value": "Medium"
73 },
74 {
75 "key": "L",
76 "value": "Large"
77 }
78 ]
79 },
80 {
81 "name": "Colour",
82 "description": "Colour of the t-shirt",
83 "key": "colour",
84 "values": [
85 {
86 "key": "red",
87 "value": "Red"
88 },
89 {
90 "key": "green",
91 "value": "Green"
92 }
93 ]
94 }
95 ],
96 "queuetoken": 421,
97 "saleendts": "2016-01-01 00:00:00",
98 "saleschannels": [ 1, 2, 3 ],
99 "salestartts": "2016-01-01 00:00:00",
100 "translations": {
101 "properties:size:L:nl": "Groot",
102 "properties:size:S:nl": "Klein"
103 },
104 "isarchived": false,
105 "createdts": "2014-09-26 15:24:36",
106 "lastupdatets": "2014-09-26 15:24:36"
107}
Request body fields
Field | Description |
---|---|
categoryid int | Category for the product. Categories can be managed in account parameters and indicate the labels for a single and multiple product and also what labels to use for the holders of the product. If not set, the UI will fallback to default labels. Example value:1 |
layoutid int | Optional layout for the product. If not specified, there will be no ticket generated for the product Example value:1 |
name mlstring (required) | Name for the product Example value:"T-shirt" |
code string | Unique 12-digit for the product Example value:"123412341234" |
description | Description for the product Example value:"The new t-shirt is made of 100% cotton" |
groupbycustomfield int | The customfield that is used to group the option bundle in the UI (websales and backoffice) Example value:10003 |
instancevalues ProductInstancevalues (required) | Instancevalues control the price for a product and for non simple products it also controls the content of the product. All products should have a default instancevalue and a set of exceptions (if there are any). If no specific exception is found for the selected product, the default instancevalue is used. Example value:{ "default": { "price": 25.000000, "voucher": { "amount": 10.000000, "voucherid": 123 } }, "exceptions": [ { "properties": { "colour": [ "red" ], "size": [ "S" ] }, "value": { "price": 15.000000, "voucher": { "amount": 10.000000, "voucherid": 123 } } }, { "properties": { "colour": [ "red" ], "size": [ "M" ] }, "value": { "price": 17.000000, "voucher": { "amount": 30.000000, "voucherid": 124 } } } ] } |
maxadditionaltickets int | The amount of individual tickets per event that can be purchased alongside this bundle. Example value:3 |
printtickets bool | If true, tickets for items that belong to the product will be printed when printing the product. Example value:true |
properties | Definition of possible properties for the product. A product can have one or more properties. Properties can be used to introduce variants of a product (sizes of a t-shirt for example). Example value:[ { "name": "Size", "description": "Size of the t-shirt", "key": "size", "values": [ { "key": "S", "value": "Small" }, { "key": "M", "value": "Medium" }, { "key": "L", "value": "Large" } ] }, { "name": "Colour", "description": "Colour of the t-shirt", "key": "colour", "values": [ { "key": "red", "value": "Red" }, { "key": "green", "value": "Green" } ] } ] |
queuetoken int | Queue ID See rate limiting for more info. Example value:421 |
saleendts timestamp | End of sales Example value:"2016-01-01 00:00:00" |
saleschannels int[] | Sales is active for these saleschannels Example value:[ 1, 2, 3 ] |
salestartts timestamp | Start of sales Example value:"2016-01-01 00:00:00" |
translations map<string, string> | Translations for the product properties Example value:{ "properties:size:L:nl": "Groot", "properties:size:S:nl": "Klein" } |
Type reference: Product
Result fields
Field | Description |
---|---|
id int | Unique ID Example value:123 |
typeid int | Type ID Example value:26001 |
categoryid int | Category for the product. Categories can be managed in account parameters and indicate the labels for a single and multiple product and also what labels to use for the holders of the product. If not set, the UI will fallback to default labels. Example value:1 |
layoutid int | Optional layout for the product. If not specified, there will be no ticket generated for the product Example value:1 |
name | Name for the product Example value:"T-shirt" |
code string | Unique 12-digit for the product Example value:"123412341234" |
description | Description for the product Example value:"The new t-shirt is made of 100% cotton" |
groupbycustomfield int | The customfield that is used to group the option bundle in the UI (websales and backoffice) Example value:10003 |
instancevalues | Instancevalues control the price for a product and for non simple products it also controls the content of the product. All products should have a default instancevalue and a set of exceptions (if there are any). If no specific exception is found for the selected product, the default instancevalue is used. Example value:{ "default": { "price": 25.000000, "voucher": { "amount": 10.000000, "voucherid": 123 } }, "exceptions": [ { "properties": { "colour": [ "red" ], "size": [ "S" ] }, "value": { "price": 15.000000, "voucher": { "amount": 10.000000, "voucherid": 123 } } }, { "properties": { "colour": [ "red" ], "size": [ "M" ] }, "value": { "price": 17.000000, "voucher": { "amount": 30.000000, "voucherid": 124 } } } ] } |
maxadditionaltickets int | The amount of individual tickets per event that can be purchased alongside this bundle. Example value:3 |
printtickets bool | If true, tickets for items that belong to the product will be printed when printing the product. Example value:true |
properties | Definition of possible properties for the product. A product can have one or more properties. Properties can be used to introduce variants of a product (sizes of a t-shirt for example). Example value:[ { "name": "Size", "description": "Size of the t-shirt", "key": "size", "values": [ { "key": "S", "value": "Small" }, { "key": "M", "value": "Medium" }, { "key": "L", "value": "Large" } ] }, { "name": "Colour", "description": "Colour of the t-shirt", "key": "colour", "values": [ { "key": "red", "value": "Red" }, { "key": "green", "value": "Green" } ] } ] |
queuetoken int | Queue ID See rate limiting for more info. Example value:421 |
saleendts timestamp | End of sales Example value:"2016-01-01 00:00:00" |
saleschannels int[] | Sales is active for these saleschannels Example value:[ 1, 2, 3 ] |
salestartts timestamp | Start of sales Example value:"2016-01-01 00:00:00" |
translations map<string, string> | Translations for the product properties Example value:{ "properties:size:L:nl": "Groot", "properties:size:S:nl": "Klein" } |
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: Product