Create a new contact
Content
Resource URL
https://apps.ticketmatic.com/api/1/{accountname}/contacts
Description
Creates a new contact
Example
Request
1use Ticketmatic\Endpoints\Contacts;
2
3$result = Contacts::create($client, array(
4 "addresses" => array(
5 array(
6 "id" => 28,
7 "typeid" => 1,
8 "city" => "Leuven",
9 "country" => "Belgium",
10 "countrycode" => "BE",
11 "customerid" => 9.364924e+06,
12 "street1" => "Main street",
13 "type" => "Home",
14 "zip" => "3000",
15 ),
16 ),
17 "appnotifications" => array(
18 31001,
19 ),
20 "apponboardingstatus" => 32001,
21 "appoptin" => array(
22 "ip" => "192.168.1.1",
23 "message" => "I accept",
24 "method" => "web",
25 "status" => true,
26 "ts" => "2018-03-26 15:32:17",
27 ),
28 "appphone" => "+32473112233",
29 "apptoken" => "eyJhbGciOiJSUzI1NiIsInR5cCI6I",
30 "birthdate" => "1986-09-26",
31 "company" => "Mega Corp",
32 "customertitleid" => 12,
33 "email" => "developers@ticketmatic.com",
34 "firstname" => "John",
35 "image" => "https://www.ticketmatic.com/image.jpg",
36 "languagecode" => "NL",
37 "lastname" => "Doe",
38 "lookup" => array(
39 "contacts" => array(
40 ),
41 ),
42 "middlename" => "K",
43 "optins" => array(
44 array(
45 "id" => 29323,
46 "info" => array(
47 "method" => "boxoffice",
48 "remarks" => "The customer accepted the terms.",
49 ),
50 "optinid" => 827,
51 "status" => 7602,
52 ),
53 ),
54 "organizationfunction" => "Director of ticketing",
55 "phonenumbers" => array(
56 array(
57 "id" => 123,
58 "typeid" => 3,
59 "customerid" => 9.364924e+06,
60 "number" => "+3216881940",
61 "type" => "Home",
62 ),
63 ),
64 "relationships" => array(
65 array(
66 "id" => 1,
67 "typeid" => 47001,
68 "childcontactid" => 10000,
69 "parentcontactid" => 9.364924e+06,
70 ),
71 ),
72 "relationtypes" => array(
73 1,
74 2,
75 ),
76 "sendmail" => false,
77 "sex" => "M",
78 "vatnumber" => "BE123456789",
79));
Response
1object(\Ticketmatic\Model\Contact) (30) {
2 ["id"]=>
3 int(0)
4 ["addresses"]=>
5 array(1) {
6 [0]=>
7 object(\Ticketmatic\Model\Address) (9) {
8 ["id"]=>
9 int(0)
10 ["typeid"]=>
11 int(0)
12 ["city"]=>
13 string(6) "Leuven"
14 ["country"]=>
15 string(7) "Belgium"
16 ["countrycode"]=>
17 string(2) "BE"
18 ["customerid"]=>
19 int(0)
20 ["street1"]=>
21 string(11) "Main street"
22 ["type"]=>
23 string(4) "Home"
24 ["zip"]=>
25 string(4) "3000"
26 }
27 }
28 ["appnotifications"]=>
29 array(1) {
30 [0]=>
31 int(0)
32 }
33 ["apponboardingstatus"]=>
34 int(0)
35 ["appoptin"]=>
36 object(\Ticketmatic\Model\Appoptin) (5) {
37 ["ip"]=>
38 string(11) "192.168.1.1"
39 ["message"]=>
40 string(8) "I accept"
41 ["method"]=>
42 string(3) "web"
43 ["status"]=>
44 bool(true)
45 ["ts"]=>
46 string(19) "2018-03-26 15:32:17"
47 }
48 ["appphone"]=>
49 string(12) "+32473112233"
50 ["apptoken"]=>
51 string(29) "eyJhbGciOiJSUzI1NiIsInR5cCI6I"
52 ["birthdate"]=>
53 object(\DateTime) (3) {
54 ["date"]=>
55 string(26) "1986-09-26.000000"
56 ["timezone_type"]=>
57 int(3)
58 ["timezone"]=>
59 string(3) "UTC"
60 }
61 ["company"]=>
62 string(9) "Mega Corp"
63 ["customertitleid"]=>
64 int(0)
65 ["email"]=>
66 string(26) "developers@ticketmatic.com"
67 ["firstname"]=>
68 string(4) "John"
69 ["image"]=>
70 string(37) "https://www.ticketmatic.com/image.jpg"
71 ["languagecode"]=>
72 string(2) "NL"
73 ["lastname"]=>
74 string(3) "Doe"
75 ["lookup"]=>
76 array(1) {
77 ["contacts"]=>
78 array(0) {
79 }
80 }
81 ["middlename"]=>
82 string(1) "K"
83 ["optins"]=>
84 array(1) {
85 [0]=>
86 object(\Ticketmatic\Model\ContactOptIn) (5) {
87 ["id"]=>
88 int(0)
89 ["info"]=>
90 object(\Ticketmatic\Model\ContactOptInInfo) (2) {
91 ["method"]=>
92 string(9) "boxoffice"
93 ["remarks"]=>
94 string(32) "The customer accepted the terms."
95 }
96 ["optinid"]=>
97 int(0)
98 ["status"]=>
99 int(0)
100 }
101 }
102 ["organizationfunction"]=>
103 string(21) "Director of ticketing"
104 ["phonenumbers"]=>
105 array(1) {
106 [0]=>
107 object(\Ticketmatic\Model\Phonenumber) (5) {
108 ["id"]=>
109 int(0)
110 ["typeid"]=>
111 int(0)
112 ["customerid"]=>
113 int(0)
114 ["number"]=>
115 string(11) "+3216881940"
116 ["type"]=>
117 string(4) "Home"
118 }
119 }
120 ["relationships"]=>
121 array(1) {
122 [0]=>
123 object(\Ticketmatic\Model\ContactRelationship) (4) {
124 ["id"]=>
125 int(0)
126 ["typeid"]=>
127 int(0)
128 ["childcontactid"]=>
129 int(0)
130 ["parentcontactid"]=>
131 int(0)
132 }
133 }
134 ["relationtypes"]=>
135 array(2) {
136 [0]=>
137 int(0)
138 [1]=>
139 int(0)
140 }
141 ["sendmail"]=>
142 bool(false)
143 ["sex"]=>
144 string(1) "M"
145 ["status"]=>
146 string(10) "incomplete"
147 ["subscribed"]=>
148 bool(false)
149 ["vatnumber"]=>
150 string(11) "BE123456789"
151 ["isdeleted"]=>
152 bool(false)
153 ["createdts"]=>
154 object(\DateTime) (3) {
155 ["date"]=>
156 string(26) "2014-09-26 15:24:36.000000"
157 ["timezone_type"]=>
158 int(3)
159 ["timezone"]=>
160 string(3) "UTC"
161 }
162 ["lastupdatets"]=>
163 object(\DateTime) (3) {
164 ["date"]=>
165 string(26) "2014-09-26 15:24:36.000000"
166 ["timezone_type"]=>
167 int(3)
168 ["timezone"]=>
169 string(3) "UTC"
170 }
171}
Request
1import (
2 "github.com/ticketmatic/tm-go/ticketmatic"
3 "github.com/ticketmatic/tm-go/ticketmatic/contacts"
4)
5
6result, err := contacts.Create(client, &ticketmatic.Contact{
7 Addresses: []*ticketmatic.Address{
8 &ticketmatic.Address{
9 Id: 28,
10 Typeid: 1,
11 City: "Leuven",
12 Country: "Belgium",
13 Countrycode: "BE",
14 Customerid: 9364924,
15 Street1: "Main street",
16 Type: "Home",
17 Zip: "3000",
18 },
19 },
20 Appnotifications: []int64{
21 31001,
22 },
23 Apponboardingstatus: 32001,
24 Appoptin: &ticketmatic.Appoptin{
25 Ip: "192.168.1.1",
26 Message: "I accept",
27 Method: "web",
28 Status: true,
29 Ts: "2018-03-26 15:32:17",
30 },
31 Appphone: "+32473112233",
32 Apptoken: "eyJhbGciOiJSUzI1NiIsInR5cCI6I",
33 Birthdate: ticketmatic.NewTime(ticketmatic.MustParseTime("1986-09-26")),
34 Company: "Mega Corp",
35 Customertitleid: 12,
36 Email: "developers@ticketmatic.com",
37 Firstname: "John",
38 Image: "https://www.ticketmatic.com/image.jpg",
39 Languagecode: "NL",
40 Lastname: "Doe",
41 Lookup: map[string]interface{}{
42 "contacts": []interface {}{},
43 },
44 Middlename: "K",
45 Optins: []*ticketmatic.ContactOptIn{
46 &ticketmatic.ContactOptIn{
47 Id: 29323,
48 Info: &ticketmatic.ContactOptInInfo{
49 Method: "boxoffice",
50 Remarks: "The customer accepted the terms.",
51 },
52 Optinid: 827,
53 Status: 7602,
54 },
55 },
56 Organizationfunction: "Director of ticketing",
57 Phonenumbers: []*ticketmatic.Phonenumber{
58 &ticketmatic.Phonenumber{
59 Id: 123,
60 Typeid: 3,
61 Customerid: 9364924,
62 Number: "+3216881940",
63 Type: "Home",
64 },
65 },
66 Relationships: []*ticketmatic.ContactRelationship{
67 &ticketmatic.ContactRelationship{
68 Id: 1,
69 Typeid: 47001,
70 Childcontactid: 10000,
71 Parentcontactid: 9364924,
72 },
73 },
74 Relationtypes: []int64{
75 1,
76 2,
77 },
78 Sendmail: false,
79 Sex: "M",
80 Vatnumber: "BE123456789",
81})
Response
1result := &ticketmatic.Contact{
2 Id: 9364924,
3 Addresses: []*ticketmatic.Address{
4 &ticketmatic.Address{
5 Id: 28,
6 Typeid: 1,
7 City: "Leuven",
8 Country: "Belgium",
9 Countrycode: "BE",
10 Customerid: 9364924,
11 Street1: "Main street",
12 Type: "Home",
13 Zip: "3000",
14 },
15 },
16 Appnotifications: []int64{
17 31001,
18 },
19 Apponboardingstatus: 32001,
20 Appoptin: &ticketmatic.Appoptin{
21 Ip: "192.168.1.1",
22 Message: "I accept",
23 Method: "web",
24 Status: true,
25 Ts: "2018-03-26 15:32:17",
26 },
27 Appphone: "+32473112233",
28 Apptoken: "eyJhbGciOiJSUzI1NiIsInR5cCI6I",
29 Birthdate: ticketmatic.NewTime(ticketmatic.MustParseTime("1986-09-26")),
30 Company: "Mega Corp",
31 Customertitleid: 12,
32 Email: "developers@ticketmatic.com",
33 Firstname: "John",
34 Image: "https://www.ticketmatic.com/image.jpg",
35 Languagecode: "NL",
36 Lastname: "Doe",
37 Lookup: map[string]interface{}{
38 "contacts": []interface {}{},
39 },
40 Middlename: "K",
41 Optins: []*ticketmatic.ContactOptIn{
42 &ticketmatic.ContactOptIn{
43 Id: 29323,
44 Info: &ticketmatic.ContactOptInInfo{
45 Method: "boxoffice",
46 Remarks: "The customer accepted the terms.",
47 },
48 Optinid: 827,
49 Status: 7602,
50 },
51 },
52 Organizationfunction: "Director of ticketing",
53 Phonenumbers: []*ticketmatic.Phonenumber{
54 &ticketmatic.Phonenumber{
55 Id: 123,
56 Typeid: 3,
57 Customerid: 9364924,
58 Number: "+3216881940",
59 Type: "Home",
60 },
61 },
62 Relationships: []*ticketmatic.ContactRelationship{
63 &ticketmatic.ContactRelationship{
64 Id: 1,
65 Typeid: 47001,
66 Childcontactid: 10000,
67 Parentcontactid: 9364924,
68 },
69 },
70 Relationtypes: []int64{
71 1,
72 2,
73 },
74 Sendmail: false,
75 Sex: "M",
76 Status: "incomplete",
77 Subscribed: false,
78 Vatnumber: "BE123456789",
79 Isdeleted: false,
80 Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
81 Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
82}
Request
1POST /api/1/{accountname}/contacts HTTP/1.1
2Content-Type: application/json
3
4{
5 "addresses": [
6 {
7 "id": 28,
8 "typeid": 1,
9 "city": "Leuven",
10 "country": "Belgium",
11 "countrycode": "BE",
12 "customerid": 9364924,
13 "street1": "Main street",
14 "type": "Home",
15 "zip": "3000"
16 }
17 ],
18 "appnotifications": [ 31001 ],
19 "apponboardingstatus": 32001,
20 "appoptin": {
21 "ip": "192.168.1.1",
22 "message": "I accept",
23 "method": "web",
24 "status": true,
25 "ts": "2018-03-26 15:32:17"
26 },
27 "appphone": "+32473112233",
28 "apptoken": "eyJhbGciOiJSUzI1NiIsInR5cCI6I",
29 "birthdate": "1986-09-26",
30 "company": "Mega Corp",
31 "customertitleid": 12,
32 "email": "developers@ticketmatic.com",
33 "firstname": "John",
34 "image": "https://www.ticketmatic.com/image.jpg",
35 "languagecode": "NL",
36 "lastname": "Doe",
37 "lookup": {
38 "contacts": []
39 },
40 "middlename": "K",
41 "optins": [
42 {
43 "id": 29323,
44 "info": {
45 "method": "boxoffice",
46 "remarks": "The customer accepted the terms."
47 },
48 "optinid": 827,
49 "status": 7602
50 }
51 ],
52 "organizationfunction": "Director of ticketing",
53 "phonenumbers": [
54 {
55 "id": 123,
56 "typeid": 3,
57 "customerid": 9364924,
58 "number": "+3216881940",
59 "type": "Home"
60 }
61 ],
62 "relationships": [
63 {
64 "id": 1,
65 "typeid": 47001,
66 "childcontactid": 10000,
67 "parentcontactid": 9364924
68 }
69 ],
70 "relationtypes": [ 1, 2 ],
71 "sendmail": false,
72 "sex": "M",
73 "vatnumber": "BE123456789"
74}
Response
1HTTP/1.1 200 OK
2Content-Type: application/json
3
4{
5 "id": 9364924,
6 "addresses": [
7 {
8 "id": 28,
9 "typeid": 1,
10 "city": "Leuven",
11 "country": "Belgium",
12 "countrycode": "BE",
13 "customerid": 9364924,
14 "street1": "Main street",
15 "type": "Home",
16 "zip": "3000"
17 }
18 ],
19 "appnotifications": [ 31001 ],
20 "apponboardingstatus": 32001,
21 "appoptin": {
22 "ip": "192.168.1.1",
23 "message": "I accept",
24 "method": "web",
25 "status": true,
26 "ts": "2018-03-26 15:32:17"
27 },
28 "appphone": "+32473112233",
29 "apptoken": "eyJhbGciOiJSUzI1NiIsInR5cCI6I",
30 "birthdate": "1986-09-26",
31 "company": "Mega Corp",
32 "customertitleid": 12,
33 "email": "developers@ticketmatic.com",
34 "firstname": "John",
35 "image": "https://www.ticketmatic.com/image.jpg",
36 "languagecode": "NL",
37 "lastname": "Doe",
38 "lookup": {
39 "contacts": []
40 },
41 "middlename": "K",
42 "optins": [
43 {
44 "id": 29323,
45 "info": {
46 "method": "boxoffice",
47 "remarks": "The customer accepted the terms."
48 },
49 "optinid": 827,
50 "status": 7602
51 }
52 ],
53 "organizationfunction": "Director of ticketing",
54 "phonenumbers": [
55 {
56 "id": 123,
57 "typeid": 3,
58 "customerid": 9364924,
59 "number": "+3216881940",
60 "type": "Home"
61 }
62 ],
63 "relationships": [
64 {
65 "id": 1,
66 "typeid": 47001,
67 "childcontactid": 10000,
68 "parentcontactid": 9364924
69 }
70 ],
71 "relationtypes": [ 1, 2 ],
72 "sendmail": false,
73 "sex": "M",
74 "status": "incomplete",
75 "subscribed": false,
76 "vatnumber": "BE123456789",
77 "isdeleted": false,
78 "createdts": "2014-09-26 15:24:36",
79 "lastupdatets": "2014-09-26 15:24:36"
80}
Request body fields
Field | Description |
---|---|
addresses Address[] | Addresses Example value:[ { "id": 28, "typeid": 1, "city": "Leuven", "country": "Belgium", "countrycode": "BE", "customerid": 9364924, "street1": "Main street", "type": "Home", "zip": "3000" } ] |
appnotifications int[] | App notifications Example value:[ 31001 ] |
apponboardingstatus int | App onboardingstatus Example value:32001 |
appoptin | App optin Example value:{ "ip": "192.168.1.1", "message": "I accept", "method": "web", "status": true, "ts": "2018-03-26 15:32:17" } |
appphone string | App phone Example value:"+32473112233" |
apptoken string | App token Example value:"eyJhbGciOiJSUzI1NiIsInR5cCI6I" |
birthdate timestamp | Birth date Example value:"1986-09-26" |
company string | Company Example value:"Mega Corp" |
customertitleid int | Customer title ID (also determines the gender of the contact) Example value:12 |
email string (required) | E-mail address Example value:"developers@ticketmatic.com" |
firstname string | First name Example value:"John" |
image string | Image url Example value:"https://www.ticketmatic.com/image.jpg" |
languagecode string | Language (ISO 639-1 code) Example value:"NL" |
lastname string | Last name Example value:"Doe" |
lookup map<string, mixed> (required) | Related objects Example value:{ "contacts": [] } |
middlename string | Middle name Example value:"K" |
optins | A list of opt ins Example value:[ { "id": 29323, "info": { "method": "boxoffice", "remarks": "The customer accepted the terms." }, "optinid": 827, "status": 7602 } ] |
organizationfunction string | Job function Example value:"Director of ticketing" |
phonenumbers | Phone numbers Example value:[ { "id": 123, "typeid": 3, "customerid": 9364924, "number": "+3216881940", "type": "Home" } ] |
relationships | A list of contact relationships Example value:[ { "id": 1, "typeid": 47001, "childcontactid": 10000, "parentcontactid": 9364924 } ] |
relationtypes int[] | Relation type IDs Example value:[ 1, 2 ] |
sendmail bool (required) |
|
Type reference: Contact
Result fields
Field | Description |
---|---|
id int | Contact ID Example value:9364924 |
addresses Address[] | Addresses Example value:[ { "id": 28, "typeid": 1, "city": "Leuven", "country": "Belgium", "countrycode": "BE", "customerid": 9364924, "street1": "Main street", "type": "Home", "zip": "3000" } ] |
appnotifications int[] | App notifications Example value:[ 31001 ] |
apponboardingstatus int | App onboardingstatus Example value:32001 |
appoptin | App optin Example value:{ "ip": "192.168.1.1", "message": "I accept", "method": "web", "status": true, "ts": "2018-03-26 15:32:17" } |
appphone string | App phone Example value:"+32473112233" |
apptoken string | App token Example value:"eyJhbGciOiJSUzI1NiIsInR5cCI6I" |
birthdate timestamp | Birth date Example value:"1986-09-26" |
company string | Company Example value:"Mega Corp" |
customertitleid int | Customer title ID (also determines the gender of the contact) Example value:12 |
email string | E-mail address Example value:"developers@ticketmatic.com" |
firstname string | First name Example value:"John" |
image string | Image url Example value:"https://www.ticketmatic.com/image.jpg" |
languagecode string | Language (ISO 639-1 code) Example value:"NL" |
lastname string | Last name Example value:"Doe" |
lookup map<string, mixed> | Related objects Example value:{ "contacts": [] } |
middlename string | Middle name Example value:"K" |
optins | A list of opt ins Example value:[ { "id": 29323, "info": { "method": "boxoffice", "remarks": "The customer accepted the terms." }, "optinid": 827, "status": 7602 } ] |
organizationfunction string | Job function Example value:"Director of ticketing" |
phonenumbers | Phone numbers Example value:[ { "id": 123, "typeid": 3, "customerid": 9364924, "number": "+3216881940", "type": "Home" } ] |
relationships | A list of contact relationships Example value:[ { "id": 1, "typeid": 47001, "childcontactid": 10000, "parentcontactid": 9364924 } ] |
relationtypes int[] | Relation type IDs Example value:[ 1, 2 ] |
sendmail bool | |
sex string | Sex Example value:"M" |
status string | Contact status Possible values:
"incomplete" |
subscribed bool | Whether or not this contact is subscribed in the e-mail marketing integration |
vatnumber string | VAT Number (for organizations) Example value:"BE123456789" |
isdeleted bool | Whether or not this contact has been deleted |
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: Contact