Create a new document
Content
Resource URL
https://apps.ticketmatic.com/api/1/{accountname}/settings/communicationanddesign/documents
Example
Request
1use Ticketmatic\Endpoints\Settings\Communicationanddesign\Documents;
2
3$result = Documents::create($client, array(
4 "typeid" => 10001,
5 "name" => "Invoice",
6 "css" => "@page {\r\n padding: 0;\r\n margin: 0pt 0pt 0pt 0pt;\r\n size: 152mm 82mm;\r\n}",
7 "description" => "Invoice document",
8 "htmltemplate" => "<html><head><meta charset=\"UTF-8\"><\\/head><body><\\/body><\\/html>",
9 "translations" => array(
10 "en" => "...",
11 "nl" => "...",
12 ),
13));
Response
1object(\Ticketmatic\Model\Document) (9) {
2 ["id"]=>
3 int(0)
4 ["typeid"]=>
5 int(0)
6 ["name"]=>
7 string(7) "Invoice"
8 ["css"]=>
9 string(80) "@page {
10 padding: 0;
11 margin: 0pt 0pt 0pt 0pt;
12 size: 152mm 82mm;
13}"
14 ["description"]=>
15 string(16) "Invoice document"
16 ["htmltemplate"]=>
17 string(64) "<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>"
18 ["translations"]=>
19 array(2) {
20 ["en"]=>
21 string(3) "..."
22 ["nl"]=>
23 string(3) "..."
24 }
25 ["createdts"]=>
26 object(\DateTime) (3) {
27 ["date"]=>
28 string(26) "2014-09-26 15:24:36.000000"
29 ["timezone_type"]=>
30 int(3)
31 ["timezone"]=>
32 string(3) "UTC"
33 }
34 ["lastupdatets"]=>
35 object(\DateTime) (3) {
36 ["date"]=>
37 string(26) "2014-09-26 15:24:36.000000"
38 ["timezone_type"]=>
39 int(3)
40 ["timezone"]=>
41 string(3) "UTC"
42 }
43}
44
Request
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/settings/communicationanddesign/documents"
4)
5
6result, err := documents.Create(client, &ticketmatic.Document{
7 Typeid: 10001,
8 Name: "Invoice",
9 Css: "@page {\r\n padding: 0;\r\n margin: 0pt 0pt 0pt 0pt;\r\n size: 152mm 82mm;\r\n}",
10 Description: "Invoice document",
11 Htmltemplate: "<html><head><meta charset=\"UTF-8\"><\\/head><body><\\/body><\\/html>",
12 Translations: map[string]string{
13 "en": "...",
14 "nl": "...",
15 },
16})
Response
1result := &ticketmatic.Document{
2 Id: 123,
3 Typeid: 10001,
4 Name: "Invoice",
5 Css: "@page {\r\n padding: 0;\r\n margin: 0pt 0pt 0pt 0pt;\r\n size: 152mm 82mm;\r\n}",
6 Description: "Invoice document",
7 Htmltemplate: "<html><head><meta charset=\"UTF-8\"><\\/head><body><\\/body><\\/html>",
8 Translations: map[string]string{
9 "en": "...",
10 "nl": "...",
11 },
12 Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
13 Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
14}
Request
1POST /api/1/{accountname}/settings/communicationanddesign/documents HTTP/1.1
2Content-Type: application/json
3
4{
5 "typeid": 10001,
6 "name": "Invoice",
7 "css": "@page {
8 padding: 0;
9 margin: 0pt 0pt 0pt 0pt;
10 size: 152mm 82mm;
11}",
12 "description": "Invoice document",
13 "htmltemplate": "<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>",
14 "translations": {
15 "en": "...",
16 "nl": "..."
17 }
18}
Response
1HTTP/1.1 200 OK
2Content-Type: application/json
3
4{
5 "id": 123,
6 "typeid": 10001,
7 "name": "Invoice",
8 "css": "@page {
9 padding: 0;
10 margin: 0pt 0pt 0pt 0pt;
11 size: 152mm 82mm;
12}",
13 "description": "Invoice document",
14 "htmltemplate": "<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>",
15 "translations": {
16 "en": "...",
17 "nl": "..."
18 },
19 "createdts": "2014-09-26 15:24:36",
20 "lastupdatets": "2014-09-26 15:24:36"
21}
Request body fields
Field | Description |
---|---|
typeid int (required) | Type ID Example value:10001 |
name mlstring (required) | Name of the document Example value:"Invoice" |
css string (required) | Css content for the document template Example value:"@page { padding: 0; margin: 0pt 0pt 0pt 0pt; size: 152mm 82mm; }" |
description mlstring (required) | Description of the document Example value:"Invoice document" |
htmltemplate string (required) | HTML content for the document template Example value:"<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>" |
translations map<string, string> (required) | Translations for the document template Example value:{ "en": "...", "nl": "..." } |
Type reference: Document
Result fields
Field | Description |
---|---|
id int | Unique ID Example value:123 |
typeid int | Type ID Example value:10001 |
name | Name of the document Example value:"Invoice" |
css string | Css content for the document template Example value:"@page { padding: 0; margin: 0pt 0pt 0pt 0pt; size: 152mm 82mm; }" |
description | Description of the document Example value:"Invoice document" |
htmltemplate string | HTML content for the document template Example value:"<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>" |
translations map<string, string> | Translations for the document template Example value:{ "en": "...", "nl": "..." } |
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: Document