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) (15) {
 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      ["reporttypeid"]=>
29      int(0)
30      ["usagetypeid"]=>
31      int(0)
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    }
51  }
52}

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            Reporttypeid: 1,
16            Usagetypeid: 17001,
17            Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
18            Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
19        },
20    },
21}

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            "reporttypeid": 1,
19            "usagetypeid": 17001,
20            "createdts": "2014-09-26 15:24:36",
21            "lastupdatets": "2014-09-26 15:24:36"
22        }
23    ]
24}

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
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[]