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        "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" => array(
28            array(
29                "id" => 29323,
30                "info" => array(
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" => array(
40            array(
41                "id" => 123,
42                "typeid" => 3,
43                "customerid" => 9.364924e+06,
44                "number" => "+3216881940",
45                "type" => "Home",
46            ),
47        ),
48        "relationtypes" => array(
49            1,
50            2,
51        ),
52        "sex" => "M",
53        "status" => "incomplete",
54        "subscribed" => false,
55        "vatnumber" => "BE123456789",
56        "isdeleted" => false,
57        "createdts" => "2014-09-26 15:24:36",
58        "lastupdatets" => "2014-09-26 15:24:36",
59    ),
60));

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

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        "birthdate": "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": [
29            {
30                "id": 29323,
31                "info": {
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": [
41            {
42                "id": 123,
43                "typeid": 3,
44                "customerid": 9364924,
45                "number": "+3216881940",
46                "type": "Home"
47            }
48        ],
49        "relationtypes": [ 1, 2 ],
50        "sex": "M",
51        "status": "incomplete",
52        "subscribed": false,
53        "vatnumber": "BE123456789",
54        "isdeleted": false,
55        "createdts": "2014-09-26 15:24:36",
56        "lastupdatets": "2014-09-26 15:24:36"
57    }
58]

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" } ]
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"
status
string 
(required)

Contact status

Possible values:

  • deleted: Contact has been deleted
  • incomplete: Contact misses crucial account information
  • (blank): Normal contact
Example value:"incomplete"
subscribed
bool 
(required)

Whether or not this contact is subscribed in the e-mail marketing integration

        </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[]