Get a list of relation types

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Relationtypes;
 2
 3$result = Relationtypes::getlist($client, array(
 4    "filter" => "SELECT id FROM tm.contactrelationtype WHERE parentid=3",
 5    "includearchived" => true,
 6    "lastupdatesince" => "2014-09-26 15:24:36",
 7));
 8
 9// The parameters array is optional, it can be omitted when empty.
10$result = Relationtypes::getlist($client);

Response

 1object(Ticketmatic\Endpoints\Settings\System\RelationtypesList) (1) {
 2  ["data"]=>
 3  array(1) {
 4    [0]=>
 5    object(\Ticketmatic\Model\RelationType) (6) {
 6      ["id"]=>
 7      int(0)
 8      ["name"]=>
 9      string(7) "Sponsor"
10      ["parentid"]=>
11      int(0)
12      ["isarchived"]=>
13      bool(false)
14      ["createdts"]=>
15      object(\DateTime) (3) {
16        ["date"]=>
17        string(26) "2014-09-26 15:24:36.000000"
18        ["timezone_type"]=>
19        int(3)
20        ["timezone"]=>
21        string(3) "UTC"
22      }
23      ["lastupdatets"]=>
24      object(\DateTime) (3) {
25        ["date"]=>
26        string(26) "2014-09-26 15:24:36.000000"
27        ["timezone_type"]=>
28        int(3)
29        ["timezone"]=>
30        string(3) "UTC"
31      }
32    }
33  }
34}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/relationtypes"
 4)
 5
 6result, err := relationtypes.Getlist(client, &ticketmatic.RelationTypeQuery{
 7    Filter: "SELECT id FROM tm.contactrelationtype WHERE parentid=3",
 8    Includearchived: true,
 9    Lastupdatesince: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
10})
11
12// The query object is optional, it can be omitted when empty.
13result, err := relationtypes.Getlist(client, nil)

Response

 1result := relationtypes.&List{
 2    Data: []*ticketmatic.RelationType{
 3        &ticketmatic.RelationType{
 4            Id: 123,
 5            Name: "Sponsor",
 6            Parentid: 2,
 7            Isarchived: false,
 8            Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
 9            Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
10        },
11    },
12}

Request

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

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "data": [
 6        {
 7            "id": 123,
 8            "name": "Sponsor",
 9            "parentid": 2,
10            "isarchived": false,
11            "createdts": "2014-09-26 15:24:36",
12            "lastupdatets": "2014-09-26 15:24:36"
13        }
14    ]
15}

Parameters

FieldDescription
filter

Filter the returned items by specifying a query on the public datamodel that returns the ids.

Example value:"SELECT id FROM tm.contactrelationtype WHERE parentid=3"
includearchived

If this parameter is true, archived items will be returned as well.

Example value:true
lastupdatesince

All items that were updated since this timestamp will be returned. Timestamp should be passed in YYYY-MM-DD hh:mm:ss format.

Example value:"2014-09-26 15:24:36"

Type reference: RelationTypeQuery

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 relation type

Example value:"Sponsor"
parentid
int

ID of the parent relation type.

Example value:2
isarchived
bool

Whether or not this item is archived

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