Get a list of products
Content
Resource URL
https://apps.ticketmatic.com/api/1/{accountname}/settings/products
Example
Request
1use Ticketmatic\Endpoints\Settings\Products;
2
3$result = Products::getlist($client, array(
4 "typeid" => 26001,
5 "filter" => "SELECT id FROM tm.product WHERE saleschannels @> '[1]' OR saleschannels @> '[2]'",
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 = Products::getlist($client);
Response
1object(Ticketmatic\Endpoints\Settings\ProductsList) (1) {
2 ["data"]=>
3 array(1) {
4 [0]=>
5 object(\Ticketmatic\Model\Product) (18) {
6 ["id"]=>
7 int(0)
8 ["typeid"]=>
9 int(0)
10 ["categoryid"]=>
11 int(0)
12 ["layoutid"]=>
13 int(0)
14 ["name"]=>
15 string(7) "T-shirt"
16 ["asksubscribers"]=>
17 bool(true)
18 ["code"]=>
19 string(12) "123412341234"
20 ["description"]=>
21 string(26) "Longer product description"
22 ["instancevalues"]=>
23 object(\Ticketmatic\Model\ProductInstancevalues) (2) {
24 ["default"]=>
25 object(\Ticketmatic\Model\ProductInstanceValue) (2) {
26 ["price"]=>
27 float(25.000000)
28 ["voucher"]=>
29 object(\Ticketmatic\Model\ProductVoucherValue) (2) {
30 ["amount"]=>
31 float(10.000000)
32 ["voucherid"]=>
33 int(0)
34 }
35 }
36 ["exceptions"]=>
37 array(2) {
38 [0]=>
39 object(\Ticketmatic\Model\ProductInstanceException) (2) {
40 ["properties"]=>
41 array(2) {
42 ["colour"]=>
43 array(1) {
44 [0]=>
45 string(3) "red"
46 }
47 ["size"]=>
48 array(1) {
49 [0]=>
50 string(1) "S"
51 }
52 }
53 ["value"]=>
54 object(\Ticketmatic\Model\ProductInstanceValue) (2) {
55 ["price"]=>
56 float(15.000000)
57 ["voucher"]=>
58 object(\Ticketmatic\Model\ProductVoucherValue) (2) {
59 ["amount"]=>
60 float(10.000000)
61 ["voucherid"]=>
62 int(0)
63 }
64 }
65 }
66 [1]=>
67 object(\Ticketmatic\Model\ProductInstanceException) (2) {
68 ["properties"]=>
69 array(2) {
70 ["colour"]=>
71 array(1) {
72 [0]=>
73 string(3) "red"
74 }
75 ["size"]=>
76 array(1) {
77 [0]=>
78 string(1) "M"
79 }
80 }
81 ["value"]=>
82 object(\Ticketmatic\Model\ProductInstanceValue) (2) {
83 ["price"]=>
84 float(17.000000)
85 ["voucher"]=>
86 object(\Ticketmatic\Model\ProductVoucherValue) (2) {
87 ["amount"]=>
88 float(30.000000)
89 ["voucherid"]=>
90 int(0)
91 }
92 }
93 }
94 }
95 }
96 ["printtickets"]=>
97 bool(true)
98 ["properties"]=>
99 array(2) {
100 [0]=>
101 object(\Ticketmatic\Model\ProductProperty) (4) {
102 ["name"]=>
103 string(4) "Size"
104 ["description"]=>
105 string(19) "Size of the t-shirt"
106 ["key"]=>
107 string(4) "size"
108 ["values"]=>
109 array(3) {
110 [0]=>
111 object(\Ticketmatic\Model\KeyValueItem) (2) {
112 ["key"]=>
113 string(1) "S"
114 ["value"]=>
115 string(5) "Small"
116 }
117 [1]=>
118 object(\Ticketmatic\Model\KeyValueItem) (2) {
119 ["key"]=>
120 string(1) "M"
121 ["value"]=>
122 string(6) "Medium"
123 }
124 [2]=>
125 object(\Ticketmatic\Model\KeyValueItem) (2) {
126 ["key"]=>
127 string(1) "L"
128 ["value"]=>
129 string(5) "Large"
130 }
131 }
132 }
133 [1]=>
134 object(\Ticketmatic\Model\ProductProperty) (4) {
135 ["name"]=>
136 string(6) "Colour"
137 ["description"]=>
138 string(21) "Colour of the t-shirt"
139 ["key"]=>
140 string(6) "colour"
141 ["values"]=>
142 array(2) {
143 [0]=>
144 object(\Ticketmatic\Model\KeyValueItem) (2) {
145 ["key"]=>
146 string(3) "red"
147 ["value"]=>
148 string(3) "Red"
149 }
150 [1]=>
151 object(\Ticketmatic\Model\KeyValueItem) (2) {
152 ["key"]=>
153 string(5) "green"
154 ["value"]=>
155 string(5) "Green"
156 }
157 }
158 }
159 }
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 ["salestartts"]=>
170 object(\DateTime) (3) {
171 ["date"]=>
172 string(26) "2016-01-01 00:00:00.000000"
173 ["timezone_type"]=>
174 int(3)
175 ["timezone"]=>
176 string(3) "UTC"
177 }
178 ["salestatusmessagesid"]=>
179 int(0)
180 ["shortdescription"]=>
181 string(38) "The new t-shirt is made of 100% cotton"
182 ["isarchived"]=>
183 bool(false)
184 ["createdts"]=>
185 object(\DateTime) (3) {
186 ["date"]=>
187 string(26) "2014-09-26 15:24:36.000000"
188 ["timezone_type"]=>
189 int(3)
190 ["timezone"]=>
191 string(3) "UTC"
192 }
193 ["lastupdatets"]=>
194 object(\DateTime) (3) {
195 ["date"]=>
196 string(26) "2014-09-26 15:24:36.000000"
197 ["timezone_type"]=>
198 int(3)
199 ["timezone"]=>
200 string(3) "UTC"
201 }
202 }
203 }
204}
Request
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/settings/products"
4)
5
6result, err := products.Getlist(client, &ticketmatic.ProductQuery{
7 Typeid: 26001,
8 Filter: "SELECT id FROM tm.product WHERE saleschannels @> '[1]' OR saleschannels @> '[2]'",
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 := products.Getlist(client, nil)
Response
1result := products.&List{
2 Data: []*ticketmatic.Product{
3 &ticketmatic.Product{
4 Id: 123,
5 Typeid: 26001,
6 Categoryid: 1,
7 Layoutid: 1,
8 Name: "T-shirt",
9 Asksubscribers: true,
10 Code: "123412341234",
11 Description: "Longer product description",
12 Instancevalues: &ticketmatic.ProductInstancevalues{
13 Default: &ticketmatic.ProductInstanceValue{
14 Price: 25,
15 Voucher: &ticketmatic.ProductVoucherValue{
16 Amount: 10,
17 Voucherid: 123,
18 },
19 },
20 Exceptions: []*ticketmatic.ProductInstanceException{
21 &ticketmatic.ProductInstanceException{
22 Properties: map[string][]string{
23 "colour": []string{
24 "red",
25 },
26 "size": []string{
27 "S",
28 },
29 },
30 Value: &ticketmatic.ProductInstanceValue{
31 Price: 15,
32 Voucher: &ticketmatic.ProductVoucherValue{
33 Amount: 10,
34 Voucherid: 123,
35 },
36 },
37 },
38 &ticketmatic.ProductInstanceException{
39 Properties: map[string][]string{
40 "colour": []string{
41 "red",
42 },
43 "size": []string{
44 "M",
45 },
46 },
47 Value: &ticketmatic.ProductInstanceValue{
48 Price: 17,
49 Voucher: &ticketmatic.ProductVoucherValue{
50 Amount: 30,
51 Voucherid: 124,
52 },
53 },
54 },
55 },
56 },
57 Printtickets: true,
58 Properties: []*ticketmatic.ProductProperty{
59 &ticketmatic.ProductProperty{
60 Name: "Size",
61 Description: "Size of the t-shirt",
62 Key: "size",
63 Values: []*ticketmatic.KeyValueItem{
64 &ticketmatic.KeyValueItem{
65 Key: "S",
66 Value: "Small",
67 },
68 &ticketmatic.KeyValueItem{
69 Key: "M",
70 Value: "Medium",
71 },
72 &ticketmatic.KeyValueItem{
73 Key: "L",
74 Value: "Large",
75 },
76 },
77 },
78 &ticketmatic.ProductProperty{
79 Name: "Colour",
80 Description: "Colour of the t-shirt",
81 Key: "colour",
82 Values: []*ticketmatic.KeyValueItem{
83 &ticketmatic.KeyValueItem{
84 Key: "red",
85 Value: "Red",
86 },
87 &ticketmatic.KeyValueItem{
88 Key: "green",
89 Value: "Green",
90 },
91 },
92 },
93 },
94 Saleendts: ticketmatic.NewTime(ticketmatic.MustParseTime("2016-01-01 00:00:00")),
95 Salestartts: ticketmatic.NewTime(ticketmatic.MustParseTime("2016-01-01 00:00:00")),
96 Salestatusmessagesid: 1,
97 Shortdescription: "The new t-shirt is made of 100% cotton",
98 Isarchived: false,
99 Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
100 Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
101 },
102 },
103}
Request
1GET /api/1/{accountname}/settings/products HTTP/1.1
Response
1HTTP/1.1 200 OK
2Content-Type: application/json
3
4{
5 "data": [
6 {
7 "id": 123,
8 "typeid": 26001,
9 "categoryid": 1,
10 "layoutid": 1,
11 "name": "T-shirt",
12 "asksubscribers": true,
13 "code": "123412341234",
14 "description": "Longer product description",
15 "instancevalues": {
16 "default": {
17 "price": 25.000000,
18 "voucher": {
19 "amount": 10.000000,
20 "voucherid": 123
21 }
22 },
23 "exceptions": [
24 {
25 "properties": {
26 "colour": [
27 "red"
28 ],
29 "size": [
30 "S"
31 ]
32 },
33 "value": {
34 "price": 15.000000,
35 "voucher": {
36 "amount": 10.000000,
37 "voucherid": 123
38 }
39 }
40 },
41 {
42 "properties": {
43 "colour": [
44 "red"
45 ],
46 "size": [
47 "M"
48 ]
49 },
50 "value": {
51 "price": 17.000000,
52 "voucher": {
53 "amount": 30.000000,
54 "voucherid": 124
55 }
56 }
57 }
58 ]
59 },
60 "printtickets": true,
61 "properties": [
62 {
63 "name": "Size",
64 "description": "Size of the t-shirt",
65 "key": "size",
66 "values": [
67 {
68 "key": "S",
69 "value": "Small"
70 },
71 {
72 "key": "M",
73 "value": "Medium"
74 },
75 {
76 "key": "L",
77 "value": "Large"
78 }
79 ]
80 },
81 {
82 "name": "Colour",
83 "description": "Colour of the t-shirt",
84 "key": "colour",
85 "values": [
86 {
87 "key": "red",
88 "value": "Red"
89 },
90 {
91 "key": "green",
92 "value": "Green"
93 }
94 ]
95 }
96 ],
97 "saleendts": "2016-01-01 00:00:00",
98 "salestartts": "2016-01-01 00:00:00",
99 "salestatusmessagesid": 1,
100 "shortdescription": "The new t-shirt is made of 100% cotton",
101 "isarchived": false,
102 "createdts": "2014-09-26 15:24:36",
103 "lastupdatets": "2014-09-26 15:24:36"
104 }
105 ]
106}
Parameters
Field | Description |
---|---|
typeid
|
Type reference: ProductQuery
Result fields
This call returns an object with an array of objects in the data
field.
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" |
asksubscribers bool | If true, subscriber info is requested for each bundle in websales. Example value:true |
code string | Unique 12-digit for the product Example value:"123412341234" |
description | Description for the product Example value:"Longer product description" |
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 } } } ] } |
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" } ] } ] |
saleendts timestamp | End of sales Example value:"2016-01-01 00:00:00" |
salestartts timestamp | Start of sales Example value:"2016-01-01 00:00:00" |
salestatusmessagesid int | Sale status messages in use for this product Example value:1 |
shortdescription | Short description for the product Example value:"The new t-shirt is made of 100% cotton" |
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" |
This type can have custom fields.
Type reference: Product[]