Get a single report

Content

Resource URL

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

Example

Request

1use Ticketmatic\Endpoints\Settings\System\Reports;
2
3$result = Reports::get($client, $id);

Response

 1object(\Ticketmatic\Model\Report) (20) {
 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  ["emailschedulequery"]=>
53  string(78) "select * from op.basket where createdts > CURRENT_TIMESTAMP - INTERVAL '1 DAY'"
54  ["options"]=>
55  object(\Ticketmatic\Model\ReportOptions) (1) {
56    ["pdfpagesize"]=>
57    string(2) "A4"
58  }
59  ["reporttypeid"]=>
60  int(0)
61  ["subtitles"]=>
62  array(2) {
63    [0]=>
64    string(10) "Subtitle 1"
65    [1]=>
66    string(10) "Subtitle 2"
67  }
68  ["translations"]=>
69  array(2) {
70    ["en"]=>
71    string(3) "..."
72    ["nl"]=>
73    string(3) "..."
74  }
75  ["usagetypeid"]=>
76  int(0)
77  ["createdts"]=>
78  object(\DateTime) (3) {
79    ["date"]=>
80    string(26) "2014-09-26 15:24:36.000000"
81    ["timezone_type"]=>
82    int(3)
83    ["timezone"]=>
84    string(3) "UTC"
85  }
86  ["lastupdatets"]=>
87  object(\DateTime) (3) {
88    ["date"]=>
89    string(26) "2014-09-26 15:24:36.000000"
90    ["timezone_type"]=>
91    int(3)
92    ["timezone"]=>
93    string(3) "UTC"
94  }
95}

Request

1import (
2    "github.com/ticketmatic/tm-go/ticketmatic"
3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/reports"
4)
5
6result, err := reports.Get(client, id)

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    Emailschedulequery: "select * from op.basket where createdts > CURRENT_TIMESTAMP - INTERVAL '1 DAY'",
23    Options: &ticketmatic.ReportOptions{
24        Pdfpagesize: "A4",
25    },
26    Reporttypeid: 1,
27    Subtitles: []string{
28        "Subtitle 1",
29        "Subtitle 2",
30    },
31    Translations: map[string]string{
32        "en": "...",
33        "nl": "...",
34    },
35    Usagetypeid: 17001,
36    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
37    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
38}

Request

1GET /api/1/{accountname}/settings/system/reports/{id} HTTP/1.1

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    "emailschedulequery": "select * from op.basket where createdts > CURRENT_TIMESTAMP - INTERVAL '1 DAY'",
34    "options": {
35        "pdfpagesize": "A4"
36    },
37    "reporttypeid": 1,
38    "subtitles": [
39        "Subtitle 1",
40        "Subtitle 2"
41    ],
42    "translations": {
43        "en": "...",
44        "nl": "..."
45    },
46    "usagetypeid": 17001,
47    "createdts": "2014-09-26 15:24:36",
48    "lastupdatets": "2014-09-26 15:24:36"
49}

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
emailschedulequery
string

Report will only be sent if the given query returns at least one result.

Example value:"select * from op.basket where createdts > CURRENT_TIMESTAMP - INTERVAL '1 DAY'"
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