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    "birthdate" => "1986-09-26",
18    "company" => "Mega Corp",
19    "customertitleid" => 12,
20    "email" => "developers@ticketmatic.com",
21    "firstname" => "John",
22    "languagecode" => "NL",
23    "lastname" => "Doe",
24    "middlename" => "K",
25    "optins" => array(
26        array(
27            "id" => 29323,
28            "info" => array(
29                "method" => "boxoffice",
30                "remarks" => "The customer accepted the terms.",
31            ),
32            "optinid" => 827,
33            "status" => 7602,
34        ),
35    ),
36    "organizationfunction" => "Director of ticketing",
37    "phonenumbers" => array(
38        array(
39            "id" => 123,
40            "typeid" => 3,
41            "customerid" => 9.364924e+06,
42            "number" => "+3216881940",
43            "type" => "Home",
44        ),
45    ),
46    "relationtypes" => array(
47        1,
48        2,
49    ),
50    "sex" => "M",
51    "vatnumber" => "BE123456789",
52));

Response

  1object(\Ticketmatic\Model\Contact) (21) {
  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  ["birthdate"]=>
 29  object(\DateTime) (3) {
 30    ["date"]=>
 31    string(26) "1986-09-26.000000"
 32    ["timezone_type"]=>
 33    int(3)
 34    ["timezone"]=>
 35    string(3) "UTC"
 36  }
 37  ["company"]=>
 38  string(9) "Mega Corp"
 39  ["customertitleid"]=>
 40  int(0)
 41  ["email"]=>
 42  string(26) "developers@ticketmatic.com"
 43  ["firstname"]=>
 44  string(4) "John"
 45  ["languagecode"]=>
 46  string(2) "NL"
 47  ["lastname"]=>
 48  string(3) "Doe"
 49  ["middlename"]=>
 50  string(1) "K"
 51  ["optins"]=>
 52  array(1) {
 53    [0]=>
 54    object(\Ticketmatic\Model\ContactOptIn) (5) {
 55      ["id"]=>
 56      int(0)
 57      ["info"]=>
 58      object(\Ticketmatic\Model\ContactOptInInfo) (2) {
 59        ["method"]=>
 60        string(9) "boxoffice"
 61        ["remarks"]=>
 62        string(32) "The customer accepted the terms."
 63      }
 64      ["optinid"]=>
 65      int(0)
 66      ["status"]=>
 67      int(0)
 68    }
 69  }
 70  ["organizationfunction"]=>
 71  string(21) "Director of ticketing"
 72  ["phonenumbers"]=>
 73  array(1) {
 74    [0]=>
 75    object(\Ticketmatic\Model\Phonenumber) (5) {
 76      ["id"]=>
 77      int(0)
 78      ["typeid"]=>
 79      int(0)
 80      ["customerid"]=>
 81      int(0)
 82      ["number"]=>
 83      string(11) "+3216881940"
 84      ["type"]=>
 85      string(4) "Home"
 86    }
 87  }
 88  ["relationtypes"]=>
 89  array(2) {
 90    [0]=>
 91    int(0)
 92    [1]=>
 93    int(0)
 94  }
 95  ["sex"]=>
 96  string(1) "M"
 97  ["status"]=>
 98  string(10) "incomplete"
 99  ["subscribed"]=>
100  bool(false)
101  ["vatnumber"]=>
102  string(11) "BE123456789"
103  ["isdeleted"]=>
104  bool(false)
105  ["createdts"]=>
106  object(\DateTime) (3) {
107    ["date"]=>
108    string(26) "2014-09-26 15:24:36.000000"
109    ["timezone_type"]=>
110    int(3)
111    ["timezone"]=>
112    string(3) "UTC"
113  }
114  ["lastupdatets"]=>
115  object(\DateTime) (3) {
116    ["date"]=>
117    string(26) "2014-09-26 15:24:36.000000"
118    ["timezone_type"]=>
119    int(3)
120    ["timezone"]=>
121    string(3) "UTC"
122  }
123}
124

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    Birthdate: ticketmatic.NewTime(ticketmatic.MustParseTime("1986-09-26")),
21    Company: "Mega Corp",
22    Customertitleid: 12,
23    Email: "developers@ticketmatic.com",
24    Firstname: "John",
25    Languagecode: "NL",
26    Lastname: "Doe",
27    Middlename: "K",
28    Optins: []*ticketmatic.ContactOptIn{
29        &ticketmatic.ContactOptIn{
30            Id: 29323,
31            Info: &ticketmatic.ContactOptInInfo{
32                Method: "boxoffice",
33                Remarks: "The customer accepted the terms.",
34            },
35            Optinid: 827,
36            Status: 7602,
37        },
38    },
39    Organizationfunction: "Director of ticketing",
40    Phonenumbers: []*ticketmatic.Phonenumber{
41        &ticketmatic.Phonenumber{
42            Id: 123,
43            Typeid: 3,
44            Customerid: 9364924,
45            Number: "+3216881940",
46            Type: "Home",
47        },
48    },
49    Relationtypes: []int64{
50        1,
51        2,
52    },
53    Sex: "M",
54    Vatnumber: "BE123456789",
55})

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    Birthdate: ticketmatic.NewTime(ticketmatic.MustParseTime("1986-09-26")),
17    Company: "Mega Corp",
18    Customertitleid: 12,
19    Email: "developers@ticketmatic.com",
20    Firstname: "John",
21    Languagecode: "NL",
22    Lastname: "Doe",
23    Middlename: "K",
24    Optins: []*ticketmatic.ContactOptIn{
25        &ticketmatic.ContactOptIn{
26            Id: 29323,
27            Info: &ticketmatic.ContactOptInInfo{
28                Method: "boxoffice",
29                Remarks: "The customer accepted the terms.",
30            },
31            Optinid: 827,
32            Status: 7602,
33        },
34    },
35    Organizationfunction: "Director of ticketing",
36    Phonenumbers: []*ticketmatic.Phonenumber{
37        &ticketmatic.Phonenumber{
38            Id: 123,
39            Typeid: 3,
40            Customerid: 9364924,
41            Number: "+3216881940",
42            Type: "Home",
43        },
44    },
45    Relationtypes: []int64{
46        1,
47        2,
48    },
49    Sex: "M",
50    Status: "incomplete",
51    Subscribed: false,
52    Vatnumber: "BE123456789",
53    Isdeleted: false,
54    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
55    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
56}

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    "birthdate": "1986-09-26",
19    "company": "Mega Corp",
20    "customertitleid": 12,
21    "email": "developers@ticketmatic.com",
22    "firstname": "John",
23    "languagecode": "NL",
24    "lastname": "Doe",
25    "middlename": "K",
26    "optins": [
27        {
28            "id": 29323,
29            "info": {
30                "method": "boxoffice",
31                "remarks": "The customer accepted the terms."
32            },
33            "optinid": 827,
34            "status": 7602
35        }
36    ],
37    "organizationfunction": "Director of ticketing",
38    "phonenumbers": [
39        {
40            "id": 123,
41            "typeid": 3,
42            "customerid": 9364924,
43            "number": "+3216881940",
44            "type": "Home"
45        }
46    ],
47    "relationtypes": [ 1, 2 ],
48    "sex": "M",
49    "vatnumber": "BE123456789"
50}

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    "birthdate": "1986-09-26",
20    "company": "Mega Corp",
21    "customertitleid": 12,
22    "email": "developers@ticketmatic.com",
23    "firstname": "John",
24    "languagecode": "NL",
25    "lastname": "Doe",
26    "middlename": "K",
27    "optins": [
28        {
29            "id": 29323,
30            "info": {
31                "method": "boxoffice",
32                "remarks": "The customer accepted the terms."
33            },
34            "optinid": 827,
35            "status": 7602
36        }
37    ],
38    "organizationfunction": "Director of ticketing",
39    "phonenumbers": [
40        {
41            "id": 123,
42            "typeid": 3,
43            "customerid": 9364924,
44            "number": "+3216881940",
45            "type": "Home"
46        }
47    ],
48    "relationtypes": [ 1, 2 ],
49    "sex": "M",
50    "status": "incomplete",
51    "subscribed": false,
52    "vatnumber": "BE123456789",
53    "isdeleted": false,
54    "createdts": "2014-09-26 15:24:36",
55    "lastupdatets": "2014-09-26 15:24:36"
56}

Request body fields

FieldDescription
addresses

Addresses

Example value:[ { "id": 28, "typeid": 1, "city": "Leuven", "country": "Belgium", "countrycode": "BE", "customerid": 9364924, "street1": "Main street", "type": "Home", "zip": "3000" } ]
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"
languagecode
string

Language (ISO 639-1 code)

Example value:"NL"
lastname
string

Last name

Example value:"Doe"
middlename
string

Middle name

Example value:"K"
optins
ContactOptIn[] 
(required)

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" } ]
relationtypes
int[]

Relation type IDs

Example value:[ 1, 2 ]
sex
string

Sex

Example value:"M"
vatnumber
string

VAT Number (for organizations)

Example value:"BE123456789"

Type reference: Contact

Result fields

FieldDescription
id
int

Contact ID

Example value:9364924
addresses

Addresses

Example value:[ { "id": 28, "typeid": 1, "city": "Leuven", "country": "Belgium", "countrycode": "BE", "customerid": 9364924, "street1": "Main street", "type": "Home", "zip": "3000" } ]
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"
languagecode
string

Language (ISO 639-1 code)

Example value:"NL"
lastname
string

Last name

Example value:"Doe"
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" } ]
relationtypes
int[]

Relation type IDs

Example value:[ 1, 2 ]
sex
string

Sex

Example value:"M"
status
string

Contact status

Possible values:

  • deleted: Contact has been deleted
  • incomplete: Contact misses crucial account information
  • (blank): Normal contact
Example value:"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