Get a list of reports

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::getlist($client, array(
4    "filter" => "select id from tm.report where createdts > (now() - INTERVAL '30 days')",
5    "lastupdatesince" => "2014-09-26 15:24:36",
6));
7
8// The parameters array is optional, it can be omitted when empty.
9$result = Reports::getlist($client);

Response

 1object(Ticketmatic\Endpoints\Settings\System\ReportsList) (1) {
 2  ["data"]=>
 3  array(1) {
 4    [0]=>
 5    object(\Ticketmatic\Model\Report) (16) {
 6      ["id"]=>
 7      int(0)
 8      ["name"]=>
 9      string(18) "Financial overview"
10      ["defaultformat"]=>
11      string(3) "pdf"
12      ["description"]=>
13      string(53) "A financial overview per month for the last 12 months"
14      ["emailbcc"]=>
15      string(41) "info@mycompany.be;management@mycompany.be"
16      ["emailcc"]=>
17      string(41) "info@mycompany.be;management@mycompany.be"
18      ["emailrecipients"]=>
19      string(41) "info@mycompany.be;management@mycompany.be"
20      ["emailschedule"]=>
21      bool(false)
22      ["emailscheduledayofmonth"]=>
23      int(0)
24      ["emailscheduledayofweek"]=>
25      int(0)
26      ["emailschedulehourofday"]=>
27      int(0)
28      ["emailschedulequery"]=>
29      string(78) "select * from op.basket where createdts > CURRENT_TIMESTAMP - INTERVAL '1 DAY'"
30      ["reporttypeid"]=>
31      int(0)
32      ["usagetypeid"]=>
33      int(0)
34      ["createdts"]=>
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      ["lastupdatets"]=>
44      object(\DateTime) (3) {
45        ["date"]=>
46        string(26) "2014-09-26 15:24:36.000000"
47        ["timezone_type"]=>
48        int(3)
49        ["timezone"]=>
50        string(3) "UTC"
51      }
52    }
53  }
54}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/reports"
 4)
 5
 6result, err := reports.Getlist(client, &ticketmatic.ReportQuery{
 7    Filter: "select id from tm.report where createdts > (now() - INTERVAL '30 days')",
 8    Lastupdatesince: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
 9})
10
11// The query object is optional, it can be omitted when empty.
12result, err := reports.Getlist(client, nil)

Response

 1result := reports.&List{
 2    Data: []*ticketmatic.Report{
 3        &ticketmatic.Report{
 4            Id: 123,
 5            Name: "Financial overview",
 6            Defaultformat: "pdf",
 7            Description: "A financial overview per month for the last 12 months",
 8            Emailbcc: "info@mycompany.be;management@mycompany.be",
 9            Emailcc: "info@mycompany.be;management@mycompany.be",
10            Emailrecipients: "info@mycompany.be;management@mycompany.be",
11            Emailschedule: false,
12            Emailscheduledayofmonth: 1,
13            Emailscheduledayofweek: 7,
14            Emailschedulehourofday: 8,
15            Emailschedulequery: "select * from op.basket where createdts > CURRENT_TIMESTAMP - INTERVAL '1 DAY'",
16            Reporttypeid: 1,
17            Usagetypeid: 17001,
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        },
21    },
22}

Request

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

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "data": [
 6        {
 7            "id": 123,
 8            "name": "Financial overview",
 9            "defaultformat": "pdf",
10            "description": "A financial overview per month for the last 12 months",
11            "emailbcc": "info@mycompany.be;management@mycompany.be",
12            "emailcc": "info@mycompany.be;management@mycompany.be",
13            "emailrecipients": "info@mycompany.be;management@mycompany.be",
14            "emailschedule": false,
15            "emailscheduledayofmonth": 1,
16            "emailscheduledayofweek": 7,
17            "emailschedulehourofday": 8,
18            "emailschedulequery": "select * from op.basket where createdts > CURRENT_TIMESTAMP - INTERVAL '1 DAY'",
19            "reporttypeid": 1,
20            "usagetypeid": 17001,
21            "createdts": "2014-09-26 15:24:36",
22            "lastupdatets": "2014-09-26 15:24:36"
23        }
24    ]
25}

Parameters

FieldDescription
filter
        </td>
        <td class="description">
            <p>Filter the returned items by specifying a query on the public datamodel that returns the ids.</p> 
            <strong>Example value:</strong><code>&#34;select id from tm.report where createdts &gt; (now() - INTERVAL &#39;30 days&#39;)&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">lastupdatesince</div>
            
        </td>
        <td class="description">
            <p>All items that were updated since this timestamp will be returned. Timestamp should be passed in <code>YYYY-MM-DD hh:mm:ss</code> format.</p> 
            <strong>Example value:</strong><code>&#34;2014-09-26 15:24:36&#34;</code>
        </td>
    </tr>
</tbody>

Type reference: ReportQuery

Result fields

This call returns an object with an array of objects in the data field.

FieldDescription
id
int

Unique ID

Example value:123
name

Name of the report

Example value:"Financial overview"
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'"
reporttypeid
int

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

Example value:1
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[]