Get a list of contacts

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Contacts;
 2
 3$result = Contacts::getlist($client, array(
 4    "filter" => "select id from tm.contact where firstname = 'Ruben'",
 5    "includearchived" => false,
 6    "lastupdatesince" => "2014-09-26 15:24:36",
 7    "limit" => 100,
 8    "offset" => 100,
 9    "orderby" => "name",
10    "output" => "default",
11    "searchterm" => "John",
12));
13
14// The parameters array is optional, it can be omitted when empty.
15$result = Contacts::getlist($client);

Response

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

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/contacts"
 4)
 5
 6result, err := contacts.Getlist(client, &ticketmatic.ContactQuery{
 7    Filter: "select id from tm.contact where firstname = 'Ruben'",
 8    Includearchived: false,
 9    Lastupdatesince: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
10    Limit: 100,
11    Offset: 100,
12    Orderby: "name",
13    Output: "default",
14    Searchterm: "John",
15})
16
17// The query object is optional, it can be omitted when empty.
18result, err := contacts.Getlist(client, nil)

Response

 1result := contacts.&List{
 2    Data: []*ticketmatic.Contact{
 3        &ticketmatic.Contact{
 4            Id: 9364924,
 5            Addresses: []*ticketmatic.Address{
 6                &ticketmatic.Address{
 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: ticketmatic.NewTime(ticketmatic.MustParseTime("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: []*ticketmatic.ContactOptIn{
27                &ticketmatic.ContactOptIn{
28                    Id: 29323,
29                    Info: &ticketmatic.ContactOptInInfo{
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: []*ticketmatic.Phonenumber{
39                &ticketmatic.Phonenumber{
40                    Id: 123,
41                    Typeid: 3,
42                    Customerid: 9364924,
43                    Number: "+3216881940",
44                    Type: "Home",
45                },
46            },
47            Relationtypes: []int64{
48                1,
49                2,
50            },
51            Sex: "M",
52            Status: "incomplete",
53            Subscribed: false,
54            Vatnumber: "BE123456789",
55            Isdeleted: false,
56            Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
57            Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
58        },
59    },
60}

Request

1GET /api/1/{accountname}/contacts HTTP/1.1

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "data": [
 6        {
 7            "id": 9364924,
 8            "addresses": [
 9                {
10                    "id": 28,
11                    "typeid": 1,
12                    "city": "Leuven",
13                    "country": "Belgium",
14                    "countrycode": "BE",
15                    "customerid": 9364924,
16                    "street1": "Main street",
17                    "type": "Home",
18                    "zip": "3000"
19                }
20            ],
21            "birthdate": "1986-09-26",
22            "company": "Mega Corp",
23            "customertitleid": 12,
24            "email": "developers@ticketmatic.com",
25            "firstname": "John",
26            "languagecode": "NL",
27            "lastname": "Doe",
28            "middlename": "K",
29            "optins": [
30                {
31                    "id": 29323,
32                    "info": {
33                        "method": "boxoffice",
34                        "remarks": "The customer accepted the terms."
35                    },
36                    "optinid": 827,
37                    "status": 7602
38                }
39            ],
40            "organizationfunction": "Director of ticketing",
41            "phonenumbers": [
42                {
43                    "id": 123,
44                    "typeid": 3,
45                    "customerid": 9364924,
46                    "number": "+3216881940",
47                    "type": "Home"
48                }
49            ],
50            "relationtypes": [ 1, 2 ],
51            "sex": "M",
52            "status": "incomplete",
53            "subscribed": false,
54            "vatnumber": "BE123456789",
55            "isdeleted": false,
56            "createdts": "2014-09-26 15:24:36",
57            "lastupdatets": "2014-09-26 15:24:36"
58        }
59    ]
60}

Parameters

FieldDescription
filter
        </td>
        <td class="description">
            <p>A SQL query that returns contact IDs</p>  <p>Can be used to do arbitrary filtering. See the <a href="db/contact">database documentation for contact</a> for more information.</p> 
            <strong>Example value:</strong><code>&#34;select id from tm.contact where firstname = &#39;Ruben&#39;&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">includearchived</div>
            
        </td>
        <td class="description">
            <p>If this parameter is true, archived items will be returned as well.</p> 
            
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">lastupdatesince</div>
            
        </td>
        <td class="description">
            <p>Only include contacts that have been updated since the given 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">limit</div>
            
        </td>
        <td class="description">
            <p>Limit results to at most the given amount of contacts.</p> 
            <strong>Example value:</strong><code>100</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">offset</div>
            
        </td>
        <td class="description">
            <p>Skip the first X contacts.</p> 
            <strong>Example value:</strong><code>100</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">orderby</div>
            
        </td>
        <td class="description">
            <p>Order by the given field.</p>  <p>Supported values: <code>name</code>, <code>lastupdatets</code>, <code>createdts</code>.</p> 
            <strong>Example value:</strong><code>&#34;name&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">output</div>
            
        </td>
        <td class="description">
            <p>Output format.</p>  <p>Possible values:</p>  <ul> <li><strong>ids</strong>: Only fill the ID field</li> <li><strong>minimal</strong>: A minimal set of order fields</li> <li><strong>default</strong>: Return all order fields (also used when the output parameter is omitted)</li> </ul> 
            <strong>Example value:</strong><code>&#34;default&#34;</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">searchterm</div>
            
        </td>
        <td class="description">
            <p>A text filter string.</p>  <p>Matches against the contact name and contact details.</p> 
            <strong>Example value:</strong><code>&#34;John&#34;</code>
        </td>
    </tr>
</tbody>

Type reference: ContactQuery

Result fields

This call returns an object with an array of objects in the data field.

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"

This type can have custom fields.

Type reference: Contact[]