Import historic orders
Content
Resource URL
https://apps.ticketmatic.com/api/1/{accountname}/orders/import
Description
Up to 100 orders can be sent per call.
Many of the usual consistency checks are relaxed while importing orders. It is recommended that you only import orders that will not be changed anymore in the future.
Example
Request
1use Ticketmatic\Endpoints\Orders;
2
3$result = Orders::import($client, array(
4 array(
5 "orderid" => 1.269434e+06,
6 "code" => "86406970700",
7 "customerid" => 1256,
8 "deliveryaddress" => array(
9 "city" => "Leuven",
10 "street1" => "Main street",
11 ),
12 "deliveryscenarioid" => 1,
13 "deliverystatus" => 2602,
14 "expiryhandled" => true,
15 "expiryts" => "2014-09-26 15:24:36",
16 "ordercosts" => array(
17 array(
18 "amount" => 5.5,
19 "servicechargedefinitionid" => 12,
20 ),
21 ),
22 "payments" => array(
23 array(
24 "amount" => 24.99,
25 "paymentmethodid" => 2,
26 ),
27 ),
28 "paymentscenarioid" => 1,
29 "products" => array(
30 array(
31 "productid" => 3,
32 "properties" => array(
33 ),
34 ),
35 ),
36 "rappelhandled" => true,
37 "rappelts" => "2014-09-26 15:24:36",
38 "saleschannelid" => 1,
39 "tickets" => array(
40 array(
41 "price" => 24.99,
42 ),
43 array(
44 "price" => 24.99,
45 ),
46 ),
47 "createdts" => "2014-09-26 15:24:36",
48 "lastupdatets" => "2014-09-26 15:24:36",
49 ),
50));
Request
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/orders"
4)
5
6result, err := orders.Import(client, []*ticketmatic.ImportOrder{
7 &ticketmatic.ImportOrder{
8 Orderid: 1269434,
9 Code: "86406970700",
10 Customerid: 1256,
11 Deliveryaddress: &ticketmatic.Address{
12 City: "Leuven",
13 Street1: "Main street",
14 },
15 Deliveryscenarioid: 1,
16 Deliverystatus: 2602,
17 Expiryhandled: true,
18 Expiryts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
19 Ordercosts: []*ticketmatic.ImportOrdercost{
20 &ticketmatic.ImportOrdercost{
21 Amount: 5.5,
22 Servicechargedefinitionid: 12,
23 },
24 },
25 Payments: []*ticketmatic.ImportPayment{
26 &ticketmatic.ImportPayment{
27 Amount: 24.99,
28 Paymentmethodid: 2,
29 },
30 },
31 Paymentscenarioid: 1,
32 Products: []*ticketmatic.ImportProduct{
33 &ticketmatic.ImportProduct{
34 Productid: 3,
35 Properties: map[string]string{
36 },
37 },
38 },
39 Rappelhandled: true,
40 Rappelts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
41 Saleschannelid: 1,
42 Tickets: []*ticketmatic.ImportTicket{
43 &ticketmatic.ImportTicket{
44 Price: 24.99,
45 },
46 &ticketmatic.ImportTicket{
47 Price: 24.99,
48 },
49 },
50 Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
51 Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
52 },
53})
Request
1POST /api/1/{accountname}/orders/import HTTP/1.1
2Content-Type: application/json
3
4[
5 {
6 "orderid": 1269434,
7 "code": "86406970700",
8 "customerid": 1256,
9 "deliveryaddress": {
10 "city": "Leuven",
11 "street1": "Main street"
12 },
13 "deliveryscenarioid": 1,
14 "deliverystatus": 2602,
15 "expiryhandled": true,
16 "expiryts": "2014-09-26 15:24:36",
17 "ordercosts": [
18 {
19 "amount": 5.500000,
20 "servicechargedefinitionid": 12
21 }
22 ],
23 "payments": [
24 {
25 "amount": 24.990000,
26 "paymentmethodid": 2
27 }
28 ],
29 "paymentscenarioid": 1,
30 "products": [
31 {
32 "productid": 3,
33 "properties": {
34
35 }
36 }
37 ],
38 "rappelhandled": true,
39 "rappelts": "2014-09-26 15:24:36",
40 "saleschannelid": 1,
41 "tickets": [
42 {
43 "price": 24.990000
44 },
45 {
46 "price": 24.990000
47 }
48 ],
49 "createdts": "2014-09-26 15:24:36",
50 "lastupdatets": "2014-09-26 15:24:36"
51 }
52]
Request body fields
This call expects an array of objects in the request body.
Field | Description |
---|---|
orderid
int
(required) |
Order ID Example value:1269434
|
code
string
|
Order code Used as a unique identifier in web sales. Example value:"86406970700"
|
customerid
int
|
Customer ID Example value:1256
|
deliveryaddress
|
Address used when delivering physically Example value:{ "city": "Leuven", "street1": "Main street" }
|
deliveryscenarioid
int
|
See delivery scenarios for more info. Example value:1
|
deliverystatus
int
|
Delivery status Possible values:
2602
|
expiryhandled
bool
|
Indicates if the expired order has been handled. If set to false when importing, Ticketmatic will send our expiry mails if configured. Example value:true
|
expiryts
timestamp
|
When the order will expire. If this is specified expiryhandled should also be specified. Example value:"2014-09-26 15:24:36"
|
ordercosts
|
Order fees for the order Example value:[ { "amount": 5.500000, "servicechargedefinitionid": 12 } ]
|
payments
|
Payments in the order Example value:[ { "amount": 24.990000, "paymentmethodid": 2 } ]
|
paymentscenarioid
int
|
See payment scenarios for more info. Example value:1
|
products
|
Products in the order Example value:[ { "productid": 3, "properties": { } } ]
|
rappelhandled
bool
|
Indicates if the overdue order has been handled. If set to false when importing, Ticketmatic will send our reminder mails if configured. Example value:true
|
rappelts
timestamp
|
When a reminder mail will be sent. If this is specified rappelhandled should also be specified. Example value:"2014-09-26 15:24:36"
|
saleschannelid
int
(required) |
See sales channels for more info. Example value:1
|
tickets
|
Tickets in the order Example value:[ { "price": 24.990000 }, { "price": 24.990000 } ]
|
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: ImportOrder[]
Result fields
This call returns an array of objects.
Field | Description |
---|---|
id
int
|
Order ID Example value:1269434
|
error
string
|
Error message, if failed Example value:"Bad customer ID"
|
ok
bool
|
Whether the import succeeded |
Type reference: OrderImportStatus[]