Modify an existing document

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\Communicationanddesign\Documents;
 2
 3$result = Documents::update($client, $id, array(
 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    "enabled" => true,
 8    "htmltemplate" => "<html><head><meta charset=\"UTF-8\"><\\/head><body><\\/body><\\/html>",
 9    "options" => array(
10        "nbrperpage" => 4,
11    ),
12    "translations" => array(
13        "en" => "...",
14        "nl" => "...",
15    ),
16));

Response

 1object(\Ticketmatic\Model\Document) (11) {
 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  ["enabled"]=>
17  bool(true)
18  ["htmltemplate"]=>
19  string(64) "<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>"
20  ["options"]=>
21  object(\Ticketmatic\Model\DocumentOptions) (1) {
22    ["nbrperpage"]=>
23    int(0)
24  }
25  ["translations"]=>
26  array(2) {
27    ["en"]=>
28    string(3) "..."
29    ["nl"]=>
30    string(3) "..."
31  }
32  ["createdts"]=>
33  object(\DateTime) (3) {
34    ["date"]=>
35    string(26) "2014-09-26 15:24:36.000000"
36    ["timezone_type"]=>
37    int(3)
38    ["timezone"]=>
39    string(3) "UTC"
40  }
41  ["lastupdatets"]=>
42  object(\DateTime) (3) {
43    ["date"]=>
44    string(26) "2014-09-26 15:24:36.000000"
45    ["timezone_type"]=>
46    int(3)
47    ["timezone"]=>
48    string(3) "UTC"
49  }
50}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/communicationanddesign/documents"
 4)
 5
 6result, err := documents.Update(client, id, &ticketmatic.Document{
 7    Name: "Invoice",
 8    Css: "@page {\r\n    padding: 0;\r\n    margin: 0pt 0pt 0pt 0pt;\r\n    size: 152mm 82mm;\r\n}",
 9    Description: "Invoice document",
10    Enabled: true,
11    Htmltemplate: "<html><head><meta charset=\"UTF-8\"><\\/head><body><\\/body><\\/html>",
12    Options: &ticketmatic.DocumentOptions{
13        Nbrperpage: 4,
14    },
15    Translations: map[string]string{
16        "en": "...",
17        "nl": "...",
18    },
19})

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    Enabled: true,
 8    Htmltemplate: "<html><head><meta charset=\"UTF-8\"><\\/head><body><\\/body><\\/html>",
 9    Options: &ticketmatic.DocumentOptions{
10        Nbrperpage: 4,
11    },
12    Translations: map[string]string{
13        "en": "...",
14        "nl": "...",
15    },
16    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
17    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
18}

Request

 1PUT /api/1/{accountname}/settings/communicationanddesign/documents/{id} HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "name": "Invoice",
 6    "css": "@page {
 7    padding: 0;
 8    margin: 0pt 0pt 0pt 0pt;
 9    size: 152mm 82mm;
10}",
11    "description": "Invoice document",
12    "enabled": true,
13    "htmltemplate": "<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>",
14    "options": {
15        "nbrperpage": 4
16    },
17    "translations": {
18        "en": "...",
19        "nl": "..."
20    }
21}

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    "enabled": true,
15    "htmltemplate": "<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>",
16    "options": {
17        "nbrperpage": 4
18    },
19    "translations": {
20        "en": "...",
21        "nl": "..."
22    },
23    "createdts": "2014-09-26 15:24:36",
24    "lastupdatets": "2014-09-26 15:24:36"
25}

Request body fields

FieldDescription
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"
enabled
bool 
(required)

Translations for the document template

Example value:true
htmltemplate
string 
(required)

HTML content for the document template

Example value:"<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>"
options
DocumentOptions 
(required)

Key-value array of options. Can contain: nbrperpage

Example value:{ "nbrperpage": 4 }
translations
map<string, string> 
(required)

Translations for the document template

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

Type reference: Document

Result fields

FieldDescription
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"
enabled
bool

Translations for the document template

Example value:true
htmltemplate
string

HTML content for the document template

Example value:"<html><head><meta charset="UTF-8"><\/head><body><\/body><\/html>"
options

Key-value array of options. Can contain: nbrperpage

Example value:{ "nbrperpage": 4 }
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