Import contact

Content

Resource URL

https://apps.ticketmatic.com/api/1/{accountname}/contacts/import

Description

Up to 1000 contacts can be sent per call.

Example

Request

 1use Ticketmatic\Endpoints\Contacts;
 2
 3$result = Contacts::import($client, array(
 4    array(
 5        "id" => 9.364924e+06,
 6        "addresses" => array(
 7            array(
 8                "id" => 28,
 9                "typeid" => 1,
10                "city" => "Leuven",
11                "country" => "Belgium",
12                "countrycode" => "BE",
13                "customerid" => 9.364924e+06,
14                "street1" => "Main street",
15                "type" => "Home",
16                "zip" => "3000",
17            ),
18        ),
19        "appnotifications" => array(
20            31001,
21        ),
22        "apponboardingstatus" => 32001,
23        "appoptin" => array(
24            "ip" => "192.168.1.1",
25            "message" => "I accept",
26            "method" => "web",
27            "status" => true,
28            "ts" => "2018-03-26 15:32:17",
29        ),
30        "appphone" => "+32473112233",
31        "apptoken" => "eyJhbGciOiJSUzI1NiIsInR5cCI6I",
32        "birthdate" => "1986-09-26",
33        "company" => "Mega Corp",
34        "customertitleid" => 12,
35        "email" => "developers@ticketmatic.com",
36        "firstname" => "John",
37        "image" => "https://www.ticketmatic.com/image.jpg",
38        "languagecode" => "NL",
39        "lastname" => "Doe",
40        "lookup" => array(
41            "contacts" => array(
42                ),
43        ),
44        "middlename" => "K",
45        "optins" => array(
46            array(
47                "id" => 29323,
48                "info" => array(
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" => array(
58            array(
59                "id" => 123,
60                "typeid" => 3,
61                "customerid" => 9.364924e+06,
62                "number" => "+3216881940",
63                "type" => "Home",
64            ),
65        ),
66        "relationships" => array(
67            array(
68                "id" => 1,
69                "typeid" => 47001,
70                "childcontactid" => 10000,
71                "parentcontactid" => 9.364924e+06,
72            ),
73        ),
74        "relationtypes" => array(
75            1,
76            2,
77        ),
78        "sendmail" => false,
79        "sex" => "M",
80        "status" => "incomplete",
81        "subscribed" => false,
82        "vatnumber" => "BE123456789",
83        "isdeleted" => false,
84        "createdts" => "2014-09-26 15:24:36",
85        "lastupdatets" => "2014-09-26 15:24:36",
86    ),
87));

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/contacts"
 4)
 5
 6result, err := contacts.Import(client, []*ticketmatic.Contact{
 7    &ticketmatic.Contact{
 8        Id: 9364924,
 9        Addresses: []*ticketmatic.Address{
10            &ticketmatic.Address{
11                Id: 28,
12                Typeid: 1,
13                City: "Leuven",
14                Country: "Belgium",
15                Countrycode: "BE",
16                Customerid: 9364924,
17                Street1: "Main street",
18                Type: "Home",
19                Zip: "3000",
20            },
21        },
22        Appnotifications: []int64{
23            31001,
24        },
25        Apponboardingstatus: 32001,
26        Appoptin: &ticketmatic.Appoptin{
27            Ip: "192.168.1.1",
28            Message: "I accept",
29            Method: "web",
30            Status: true,
31            Ts: "2018-03-26 15:32:17",
32        },
33        Appphone: "+32473112233",
34        Apptoken: "eyJhbGciOiJSUzI1NiIsInR5cCI6I",
35        Birthdate: ticketmatic.NewTime(ticketmatic.MustParseTime("1986-09-26")),
36        Company: "Mega Corp",
37        Customertitleid: 12,
38        Email: "developers@ticketmatic.com",
39        Firstname: "John",
40        Image: "https://www.ticketmatic.com/image.jpg",
41        Languagecode: "NL",
42        Lastname: "Doe",
43        Lookup: map[string]interface{}{
44            "contacts": []interface {}{},
45        },
46        Middlename: "K",
47        Optins: []*ticketmatic.ContactOptIn{
48            &ticketmatic.ContactOptIn{
49                Id: 29323,
50                Info: &ticketmatic.ContactOptInInfo{
51                    Method: "boxoffice",
52                    Remarks: "The customer accepted the terms.",
53                },
54                Optinid: 827,
55                Status: 7602,
56            },
57        },
58        Organizationfunction: "Director of ticketing",
59        Phonenumbers: []*ticketmatic.Phonenumber{
60            &ticketmatic.Phonenumber{
61                Id: 123,
62                Typeid: 3,
63                Customerid: 9364924,
64                Number: "+3216881940",
65                Type: "Home",
66            },
67        },
68        Relationships: []*ticketmatic.ContactRelationship{
69            &ticketmatic.ContactRelationship{
70                Id: 1,
71                Typeid: 47001,
72                Childcontactid: 10000,
73                Parentcontactid: 9364924,
74            },
75        },
76        Relationtypes: []int64{
77            1,
78            2,
79        },
80        Sendmail: false,
81        Sex: "M",
82        Status: "incomplete",
83        Subscribed: false,
84        Vatnumber: "BE123456789",
85        Isdeleted: false,
86        Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
87        Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
88    },
89})

Request

 1POST /api/1/{accountname}/contacts/import HTTP/1.1
 2Content-Type: application/json
 3
 4[
 5    {
 6        "id": 9364924,
 7        "addresses": [
 8            {
 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": [ 31001 ],
21        "apponboardingstatus": 32001,
22        "appoptin": {
23            "ip": "192.168.1.1",
24            "message": "I accept",
25            "method": "web",
26            "status": true,
27            "ts": "2018-03-26 15:32:17"
28        },
29        "appphone": "+32473112233",
30        "apptoken": "eyJhbGciOiJSUzI1NiIsInR5cCI6I",
31        "birthdate": "1986-09-26",
32        "company": "Mega Corp",
33        "customertitleid": 12,
34        "email": "developers@ticketmatic.com",
35        "firstname": "John",
36        "image": "https://www.ticketmatic.com/image.jpg",
37        "languagecode": "NL",
38        "lastname": "Doe",
39        "lookup": {
40            "contacts": []
41        },
42        "middlename": "K",
43        "optins": [
44            {
45                "id": 29323,
46                "info": {
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": [
56            {
57                "id": 123,
58                "typeid": 3,
59                "customerid": 9364924,
60                "number": "+3216881940",
61                "type": "Home"
62            }
63        ],
64        "relationships": [
65            {
66                "id": 1,
67                "typeid": 47001,
68                "childcontactid": 10000,
69                "parentcontactid": 9364924
70            }
71        ],
72        "relationtypes": [ 1, 2 ],
73        "sendmail": false,
74        "sex": "M",
75        "status": "incomplete",
76        "subscribed": false,
77        "vatnumber": "BE123456789",
78        "isdeleted": false,
79        "createdts": "2014-09-26 15:24:36",
80        "lastupdatets": "2014-09-26 15:24:36"
81    }
82]

Request body fields

This call expects an array of objects in the request body.

FieldDescription
id
int 
(required)

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" } ]
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
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" } ]
relationships
ContactRelationship[] 
(required)

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)
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">sex</div>
            <div class="type">string</div>
        </td>
        <td class="description">
            <p>Sex</p> 
            <strong>Example value:</strong><code>&#34;M&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">status</div>
            <div class="type">string&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Contact status</p>  <p>Possible values:</p>  <ul> <li><strong>deleted</strong>: Contact has been deleted</li> <li><strong>incomplete</strong>: Contact misses crucial account information</li> <li><strong>(blank)</strong>: Normal contact</li> </ul> 
            <strong>Example value:</strong><code>&#34;incomplete&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">subscribed</div>
            <div class="type">bool&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Whether or not this contact is subscribed in the e-mail marketing integration</p> 
            
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">vatnumber</div>
            <div class="type">string</div>
        </td>
        <td class="description">
            <p>VAT Number (for organizations)</p> 
            <strong>Example value:</strong><code>&#34;BE123456789&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">isdeleted</div>
            <div class="type">bool&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Whether or not this contact has been deleted</p> 
            
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">createdts</div>
            <div class="type">timestamp&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Created timestamp</p> 
            <strong>Example value:</strong><code>&#34;2014-09-26 15:24:36&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">lastupdatets</div>
            <div class="type">timestamp&nbsp;<div class="required">(required)</div></div>
        </td>
        <td class="description">
            <p>Last updated timestamp</p> 
            <strong>Example value:</strong><code>&#34;2014-09-26 15:24:36&#34;</code>
        </td>
    </tr>
</tbody>

Type reference: Contact[]

Result fields

This call returns an array of objects.

FieldDescription
id
int

Contact ID

Example value:1249230
error
string

Error message, if failed

Example value:"Invalid e-mail"
ok
bool

Whether the import succeeded

Type reference: ContactImportStatus[]