Create a new ticket layout template

Content

Resource URL

https://apps.ticketmatic.com/api/1/{accountname}/settings/communicationanddesign/ticketlayouttemplates

Example

Request

 1use Ticketmatic\Endpoints\Settings\Communicationanddesign\Ticketlayouttemplates;
 2
 3$result = Ticketlayouttemplates::create($client, array(
 4    "typeid" => 1,
 5    "name" => "Print at home",
 6    "css" => "@page {\r\n    size: A4;\r\n    margin: 0;\r\n    padding: 0;\r\n}",
 7    "deliveryscenarios" => array(
 8        1,
 9        2,
10        3,
11    ),
12    "htmltemplate" => "<!doctype html><html><head><meta charset=\"utf-8\"><\\/head><body><\\/body><\\/html>",
13    "ticketsperpage" => 1,
14    "translations" => array(
15        "en" => "...",
16        "nl" => "...",
17    ),
18));

Response

 1object(\Ticketmatic\Model\TicketLayoutTemplate) (11) {
 2  ["id"]=>
 3  int(0)
 4  ["typeid"]=>
 5  int(0)
 6  ["name"]=>
 7  string(13) "Print at home"
 8  ["css"]=>
 9  string(58) "@page {
10    size: A4;
11    margin: 0;
12    padding: 0;
13}"
14  ["deliveryscenarios"]=>
15  array(3) {
16    [0]=>
17    int(0)
18    [1]=>
19    int(0)
20    [2]=>
21    int(0)
22  }
23  ["htmltemplate"]=>
24  string(79) "<!doctype html><html><head><meta charset="utf-8"><\/head><body><\/body><\/html>"
25  ["ticketsperpage"]=>
26  int(0)
27  ["translations"]=>
28  array(2) {
29    ["en"]=>
30    string(3) "..."
31    ["nl"]=>
32    string(3) "..."
33  }
34  ["isarchived"]=>
35  bool(false)
36  ["createdts"]=>
37  object(\DateTime) (3) {
38    ["date"]=>
39    string(26) "2014-09-26 15:24:36.000000"
40    ["timezone_type"]=>
41    int(3)
42    ["timezone"]=>
43    string(3) "UTC"
44  }
45  ["lastupdatets"]=>
46  object(\DateTime) (3) {
47    ["date"]=>
48    string(26) "2014-09-26 15:24:36.000000"
49    ["timezone_type"]=>
50    int(3)
51    ["timezone"]=>
52    string(3) "UTC"
53  }
54}
55

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/communicationanddesign/ticketlayouttemplates"
 4)
 5
 6result, err := ticketlayouttemplates.Create(client, &ticketmatic.TicketLayoutTemplate{
 7    Typeid: 1,
 8    Name: "Print at home",
 9    Css: "@page {\r\n    size: A4;\r\n    margin: 0;\r\n    padding: 0;\r\n}",
10    Deliveryscenarios: []int64{
11        1,
12        2,
13        3,
14    },
15    Htmltemplate: "<!doctype html><html><head><meta charset=\"utf-8\"><\\/head><body><\\/body><\\/html>",
16    Ticketsperpage: 1,
17    Translations: map[string]string{
18        "en": "...",
19        "nl": "...",
20    },
21})

Response

 1result := &ticketmatic.TicketLayoutTemplate{
 2    Id: 123,
 3    Typeid: 1,
 4    Name: "Print at home",
 5    Css: "@page {\r\n    size: A4;\r\n    margin: 0;\r\n    padding: 0;\r\n}",
 6    Deliveryscenarios: []int64{
 7        1,
 8        2,
 9        3,
10    },
11    Htmltemplate: "<!doctype html><html><head><meta charset=\"utf-8\"><\\/head><body><\\/body><\\/html>",
12    Ticketsperpage: 1,
13    Translations: map[string]string{
14        "en": "...",
15        "nl": "...",
16    },
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/communicationanddesign/ticketlayouttemplates HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 1,
 6    "name": "Print at home",
 7    "css": "@page {
 8    size: A4;
 9    margin: 0;
10    padding: 0;
11}",
12    "deliveryscenarios": [ 1, 2, 3 ],
13    "htmltemplate": "<!doctype html><html><head><meta charset="utf-8"><\/head><body><\/body><\/html>",
14    "ticketsperpage": 1,
15    "translations": {
16        "en": "...",
17        "nl": "..."
18    }
19}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 123,
 6    "typeid": 1,
 7    "name": "Print at home",
 8    "css": "@page {
 9    size: A4;
10    margin: 0;
11    padding: 0;
12}",
13    "deliveryscenarios": [ 1, 2, 3 ],
14    "htmltemplate": "<!doctype html><html><head><meta charset="utf-8"><\/head><body><\/body><\/html>",
15    "ticketsperpage": 1,
16    "translations": {
17        "en": "...",
18        "nl": "..."
19    },
20    "isarchived": false,
21    "createdts": "2014-09-26 15:24:36",
22    "lastupdatets": "2014-09-26 15:24:36"
23}

Request body fields

FieldDescription
typeid
int 
(required)

Type ID

Example value:1
name
string 
(required)

Name for the ticket layout template

Example value:"Print at home"
css
string 
(required)

Css classes for the ticket layout template

Example value:"@page { size: A4; margin: 0; padding: 0; }"
deliveryscenarios
int[] 
(required)

Deliveryscenario’s for which this ticket layout template will be used

Example value:[ 1, 2, 3 ]
htmltemplate
string 
(required)

HTML template containing the definition for the ticket layout template

Example value:"<!doctype html><html><head><meta charset="utf-8"><\/head><body><\/body><\/html>"
ticketsperpage
int 
(required)

Number of tickets to be printed per page

Example value:1
translations
map<string, string> 
(required)

Translations for the ticket layout template

Example value:{ "en": "...", "nl": "..." }

Type reference: TicketLayoutTemplate

Result fields

FieldDescription
id
int

Unique ID

Example value:123
typeid
int

Type ID

Example value:1
name
string

Name for the ticket layout template

Example value:"Print at home"
css
string

Css classes for the ticket layout template

Example value:"@page { size: A4; margin: 0; padding: 0; }"
deliveryscenarios
int[]

Deliveryscenario’s for which this ticket layout template will be used

Example value:[ 1, 2, 3 ]
htmltemplate
string

HTML template containing the definition for the ticket layout template

Example value:"<!doctype html><html><head><meta charset="utf-8"><\/head><body><\/body><\/html>"
ticketsperpage
int

Number of tickets to be printed per page

Example value:1
translations
map<string, string>

Translations for the ticket layout template

Example value:{ "en": "...", "nl": "..." }
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: TicketLayoutTemplate