Create a new relation type

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::create($client, array(
4    "name" => "Sponsor",
5    "parentid" => 2,
6));

Response

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

Request

1import (
2    "github.com/ticketmatic/tm-go/ticketmatic"
3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/relationtypes"
4)
5
6result, err := relationtypes.Create(client, &ticketmatic.RelationType{
7    Name: "Sponsor",
8    Parentid: 2,
9})

Response

1result := &ticketmatic.RelationType{
2    Id: 123,
3    Name: "Sponsor",
4    Parentid: 2,
5    Isarchived: false,
6    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
7    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
8}

Request

1POST /api/1/{accountname}/settings/system/relationtypes HTTP/1.1
2Content-Type: application/json
3
4{
5    "name": "Sponsor",
6    "parentid": 2
7}

Response

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

Request body fields

FieldDescription
name
mlstring 
(required)

Name of the relation type

Example value:"Sponsor"
parentid
int 
(required)

ID of the parent relation type.

Example value:2

Type reference: RelationType

Result fields

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