Create a new report

Content

Resource URL

https://apps.ticketmatic.com/api/1/{accountname}/settings/system/reports

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Reports;
 2
 3$result = Reports::create($client, array(
 4    "name" => "Financial overview",
 5    "content" => array(
 6        array(
 7            array(
 8                "columns" => array(
 9                        array(
10                                "caption" => "Id",
11                                "width" => "80px",
12                            ),
13                        array(
14                                "caption" => "Naam",
15                            ),
16                    ),
17                "query" => "select id,namenl as name from ev.event",
18                "type" => "table",
19            ),
20        ),
21    ),
22    "defaultformat" => "pdf",
23    "description" => "A financial overview per month for the last 12 months",
24    "emailbcc" => "info@mycompany.be;management@mycompany.be",
25    "emailcc" => "info@mycompany.be;management@mycompany.be",
26    "emailrecipients" => "info@mycompany.be;management@mycompany.be",
27    "emailschedule" => false,
28    "emailscheduledayofmonth" => 1,
29    "emailscheduledayofweek" => 7,
30    "emailschedulehourofday" => 8,
31    "options" => array(
32        "pdfpagesize" => "A4",
33    ),
34    "reporttypeid" => 1,
35    "subtitles" => array(
36        "Subtitle 1",
37        "Subtitle 2",
38    ),
39    "translations" => array(
40        "en" => "...",
41        "nl" => "...",
42    ),
43    "usagetypeid" => 17001,
44));

Response

 1object(\Ticketmatic\Model\Report) (19) {
 2  ["id"]=>
 3  int(0)
 4  ["name"]=>
 5  string(18) "Financial overview"
 6  ["content"]=>
 7  array(1) {
 8    [0]=>
 9    array(1) {
10      [0]=>
11      array(3) {
12        ["columns"]=>
13          array(2) {
14            [0]=>
15            array(2) {
16              ["caption"]=>
17              string(2) "Id"
18              ["width"]=>
19              string(4) "80px"
20            }
21            [1]=>
22            array(1) {
23              ["caption"]=>
24              string(4) "Naam"
25            }
26          }
27        ["query"]=>
28        string(38) "select id,namenl as name from ev.event"
29        ["type"]=>
30        string(5) "table"
31      }
32    }
33  }
34  ["defaultformat"]=>
35  string(3) "pdf"
36  ["description"]=>
37  string(53) "A financial overview per month for the last 12 months"
38  ["emailbcc"]=>
39  string(41) "info@mycompany.be;management@mycompany.be"
40  ["emailcc"]=>
41  string(41) "info@mycompany.be;management@mycompany.be"
42  ["emailrecipients"]=>
43  string(41) "info@mycompany.be;management@mycompany.be"
44  ["emailschedule"]=>
45  bool(false)
46  ["emailscheduledayofmonth"]=>
47  int(0)
48  ["emailscheduledayofweek"]=>
49  int(0)
50  ["emailschedulehourofday"]=>
51  int(0)
52  ["options"]=>
53  object(\Ticketmatic\Model\ReportOptions) (1) {
54    ["pdfpagesize"]=>
55    string(2) "A4"
56  }
57  ["reporttypeid"]=>
58  int(0)
59  ["subtitles"]=>
60  array(2) {
61    [0]=>
62    string(10) "Subtitle 1"
63    [1]=>
64    string(10) "Subtitle 2"
65  }
66  ["translations"]=>
67  array(2) {
68    ["en"]=>
69    string(3) "..."
70    ["nl"]=>
71    string(3) "..."
72  }
73  ["usagetypeid"]=>
74  int(0)
75  ["createdts"]=>
76  object(\DateTime) (3) {
77    ["date"]=>
78    string(26) "2014-09-26 15:24:36.000000"
79    ["timezone_type"]=>
80    int(3)
81    ["timezone"]=>
82    string(3) "UTC"
83  }
84  ["lastupdatets"]=>
85  object(\DateTime) (3) {
86    ["date"]=>
87    string(26) "2014-09-26 15:24:36.000000"
88    ["timezone_type"]=>
89    int(3)
90    ["timezone"]=>
91    string(3) "UTC"
92  }
93}
94

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/reports"
 4)
 5
 6result, err := reports.Create(client, &ticketmatic.Report{
 7    Name: "Financial overview",
 8    Content: [][]map[string]interface{}{
 9        []map[string]interface{}{
10            map[string]interface{}{
11                "columns": []interface {}{map[string]interface {}{"caption":"Id", "width":"80px"}, map[string]interface {}{"caption":"Naam"}},
12                "query": "select id,namenl as name from ev.event",
13                "type": "table",
14            },
15        },
16    },
17    Defaultformat: "pdf",
18    Description: "A financial overview per month for the last 12 months",
19    Emailbcc: "info@mycompany.be;management@mycompany.be",
20    Emailcc: "info@mycompany.be;management@mycompany.be",
21    Emailrecipients: "info@mycompany.be;management@mycompany.be",
22    Emailschedule: false,
23    Emailscheduledayofmonth: 1,
24    Emailscheduledayofweek: 7,
25    Emailschedulehourofday: 8,
26    Options: &ticketmatic.ReportOptions{
27        Pdfpagesize: "A4",
28    },
29    Reporttypeid: 1,
30    Subtitles: []string{
31        "Subtitle 1",
32        "Subtitle 2",
33    },
34    Translations: map[string]string{
35        "en": "...",
36        "nl": "...",
37    },
38    Usagetypeid: 17001,
39})

Response

 1result := &ticketmatic.Report{
 2    Id: 123,
 3    Name: "Financial overview",
 4    Content: [][]map[string]interface{}{
 5        []map[string]interface{}{
 6            map[string]interface{}{
 7                "columns": []interface {}{map[string]interface {}{"caption":"Id", "width":"80px"}, map[string]interface {}{"caption":"Naam"}},
 8                "query": "select id,namenl as name from ev.event",
 9                "type": "table",
10            },
11        },
12    },
13    Defaultformat: "pdf",
14    Description: "A financial overview per month for the last 12 months",
15    Emailbcc: "info@mycompany.be;management@mycompany.be",
16    Emailcc: "info@mycompany.be;management@mycompany.be",
17    Emailrecipients: "info@mycompany.be;management@mycompany.be",
18    Emailschedule: false,
19    Emailscheduledayofmonth: 1,
20    Emailscheduledayofweek: 7,
21    Emailschedulehourofday: 8,
22    Options: &ticketmatic.ReportOptions{
23        Pdfpagesize: "A4",
24    },
25    Reporttypeid: 1,
26    Subtitles: []string{
27        "Subtitle 1",
28        "Subtitle 2",
29    },
30    Translations: map[string]string{
31        "en": "...",
32        "nl": "...",
33    },
34    Usagetypeid: 17001,
35    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
36    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
37}

Request

 1POST /api/1/{accountname}/settings/system/reports HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "name": "Financial overview",
 6    "content": [
 7        [
 8            {
 9                "columns": [
10                    {
11                        "caption": "Id",
12                        "width": "80px"
13                    },
14                    {
15                        "caption": "Naam"
16                    }
17                ],
18                "query": "select id,namenl as name from ev.event",
19                "type": "table"
20            }
21        ]
22    ],
23    "defaultformat": "pdf",
24    "description": "A financial overview per month for the last 12 months",
25    "emailbcc": "info@mycompany.be;management@mycompany.be",
26    "emailcc": "info@mycompany.be;management@mycompany.be",
27    "emailrecipients": "info@mycompany.be;management@mycompany.be",
28    "emailschedule": false,
29    "emailscheduledayofmonth": 1,
30    "emailscheduledayofweek": 7,
31    "emailschedulehourofday": 8,
32    "options": {
33        "pdfpagesize": "A4"
34    },
35    "reporttypeid": 1,
36    "subtitles": [
37        "Subtitle 1",
38        "Subtitle 2"
39    ],
40    "translations": {
41        "en": "...",
42        "nl": "..."
43    },
44    "usagetypeid": 17001
45}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 123,
 6    "name": "Financial overview",
 7    "content": [
 8        [
 9            {
10                "columns": [
11                    {
12                        "caption": "Id",
13                        "width": "80px"
14                    },
15                    {
16                        "caption": "Naam"
17                    }
18                ],
19                "query": "select id,namenl as name from ev.event",
20                "type": "table"
21            }
22        ]
23    ],
24    "defaultformat": "pdf",
25    "description": "A financial overview per month for the last 12 months",
26    "emailbcc": "info@mycompany.be;management@mycompany.be",
27    "emailcc": "info@mycompany.be;management@mycompany.be",
28    "emailrecipients": "info@mycompany.be;management@mycompany.be",
29    "emailschedule": false,
30    "emailscheduledayofmonth": 1,
31    "emailscheduledayofweek": 7,
32    "emailschedulehourofday": 8,
33    "options": {
34        "pdfpagesize": "A4"
35    },
36    "reporttypeid": 1,
37    "subtitles": [
38        "Subtitle 1",
39        "Subtitle 2"
40    ],
41    "translations": {
42        "en": "...",
43        "nl": "..."
44    },
45    "usagetypeid": 17001,
46    "createdts": "2014-09-26 15:24:36",
47    "lastupdatets": "2014-09-26 15:24:36"
48}

Request body fields

FieldDescription
name
mlstring 
(required)

Name of the report

Example value:"Financial overview"
content
map<string, mixed>[][] 
(required)

The actual report definition, see reports for more information.

Example value:[ [ { "columns": [ { "caption": "Id", "width": "80px" }, { "caption": "Naam" } ], "query": "select id,namenl as name from ev.event", "type": "table" } ] ]
defaultformat
string 
(required)

Reports can be generated as pdf or excel file. This field defines the default format. Possible values are ‘pdf’ or ‘excel’

Example value:"pdf"
description
mlstring 
(required)

Description of the report

Example value:"A financial overview per month for the last 12 months"
emailbcc
string 
(required)

List of email recipients that should receive the report in bcc, separated by ;

Example value:"info@mycompany.be;management@mycompany.be"
emailcc
string 
(required)

List of email recipients that should receive the report in cc, separated by ;

Example value:"info@mycompany.be;management@mycompany.be"
emailrecipients
string 
(required)

List of email recipients that should receive the report, separated by ;

Example value:"info@mycompany.be;management@mycompany.be"
emailschedule
bool 
(required)

Indicates if this report is scheduled to be sent by mail at a certain interval

        </td>
    </tr><tr>
        <td class="field">
            <div class="name">emailscheduledayofmonth</div>
            <div class="type">int&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Day of the month the report will be sent.</p> 
            <strong>Example value:</strong><code>1</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">emailscheduledayofweek</div>
            <div class="type">int&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Day of the week the report will be sent. 1 = monday -&gt; 7 = sunday</p> 
            <strong>Example value:</strong><code>7</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">emailschedulehourofday</div>
            <div class="type">int&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Hour of the day the report will be sent</p> 
            <strong>Example value:</strong><code>8</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">options</div>
            <div class="type"><a href="api/types/ReportOptions">ReportOptions</a>&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Key-value array of options. Can contain: pdfpagesize, excelpagewidth, excelscaling, usesystemfont</p> 
            <strong>Example value:</strong><code>{ &#34;pdfpagesize&#34;: &#34;A4&#34; }</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">reporttypeid</div>
            <div class="type">int&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>The report type defines the UI and parameters that are used when generating the report</p> 
            <strong>Example value:</strong><code>1</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">subtitles</div>
            <div class="type">string<span class="code">[]</span>&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>A list of subtitles for the report</p> 
            <strong>Example value:</strong><code>[ &#34;Subtitle 1&#34;, &#34;Subtitle 2&#34; ]</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">translations</div>
            <div class="type">map&lt;string, string&gt;&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>A map of language codes to <a href="http://en.wikipedia.org/wiki/Gettext">gettext .po files</a>.</p> 
            <strong>Example value:</strong><code>{ &#34;en&#34;: &#34;...&#34;, &#34;nl&#34;: &#34;...&#34; }</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">usagetypeid</div>
            <div class="type">int&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Indicates where the report is being used. Possible values: 17001 (Sales), 17002 (External sales), 17003 (Hidden)</p> 
            <strong>Example value:</strong><code>17001</code>
        </td>
    </tr>
</tbody>

Type reference: Report

Result fields

FieldDescription
id
int

Unique ID

Example value:123
name

Name of the report

Example value:"Financial overview"
content
map<string, mixed>[][]

The actual report definition, see reports for more information.

Example value:[ [ { "columns": [ { "caption": "Id", "width": "80px" }, { "caption": "Naam" } ], "query": "select id,namenl as name from ev.event", "type": "table" } ] ]
defaultformat
string

Reports can be generated as pdf or excel file. This field defines the default format. Possible values are ‘pdf’ or ‘excel’

Example value:"pdf"
description

Description of the report

Example value:"A financial overview per month for the last 12 months"
emailbcc
string

List of email recipients that should receive the report in bcc, separated by ;

Example value:"info@mycompany.be;management@mycompany.be"
emailcc
string

List of email recipients that should receive the report in cc, separated by ;

Example value:"info@mycompany.be;management@mycompany.be"
emailrecipients
string

List of email recipients that should receive the report, separated by ;

Example value:"info@mycompany.be;management@mycompany.be"
emailschedule
bool

Indicates if this report is scheduled to be sent by mail at a certain interval

emailscheduledayofmonth
int

Day of the month the report will be sent.

Example value:1
emailscheduledayofweek
int

Day of the week the report will be sent. 1 = monday -> 7 = sunday

Example value:7
emailschedulehourofday
int

Hour of the day the report will be sent

Example value:8
options

Key-value array of options. Can contain: pdfpagesize, excelpagewidth, excelscaling, usesystemfont

Example value:{ "pdfpagesize": "A4" }
reporttypeid
int

The report type defines the UI and parameters that are used when generating the report

Example value:1
subtitles
string[]

A list of subtitles for the report

Example value:[ "Subtitle 1", "Subtitle 2" ]
translations
map<string, string>

A map of language codes to gettext .po files.

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

Indicates where the report is being used. Possible values: 17001 (Sales), 17002 (External sales), 17003 (Hidden)

Example value:17001
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: Report