Get a list of opt ins

Content

Resource URL

https://apps.ticketmatic.com/api/1/{accountname}/settings/system/optins

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Optins;
 2
 3$result = Optins::getlist($client, array(
 4    "filter" => "SELECT id FROM tm.optins WHERE typeid = 40001",
 5    "includearchived" => true,
 6    "lastupdatesince" => "2014-09-26 15:24:36",
 7));
 8
 9// The parameters array is optional, it can be omitted when empty.
10$result = Optins::getlist($client);

Response

 1object(Ticketmatic\Endpoints\Settings\System\OptinsList) (1) {
 2  ["data"]=>
 3  array(1) {
 4    [0]=>
 5    object(\Ticketmatic\Model\OptIn) (11) {
 6      ["id"]=>
 7      int(0)
 8      ["typeid"]=>
 9      int(0)
10      ["name"]=>
11      string(17) "Marketing e-mails"
12      ["availability"]=>
13      array(2) {
14        [0]=>
15        object(\Ticketmatic\Model\OptInAvailability) (1) {
16          ["saleschannelid"]=>
17          int(0)
18        }
19        [1]=>
20        object(\Ticketmatic\Model\OptInAvailability) (1) {
21          ["saleschannelid"]=>
22          int(0)
23        }
24      }
25      ["caption"]=>
26      string(33) "I do not wish to receive e-mails."
27      ["description"]=>
28      string(40) "Receive marketing related communications"
29      ["nocaption"]=>
30      string(10) "No thanks."
31      ["yescaption"]=>
32      string(62) "Yes, I would like to receive marketing related communications."
33      ["isarchived"]=>
34      bool(false)
35      ["createdts"]=>
36      object(\DateTime) (3) {
37        ["date"]=>
38        string(26) "2014-09-26 15:24:36.000000"
39        ["timezone_type"]=>
40        int(3)
41        ["timezone"]=>
42        string(3) "UTC"
43      }
44      ["lastupdatets"]=>
45      object(\DateTime) (3) {
46        ["date"]=>
47        string(26) "2014-09-26 15:24:36.000000"
48        ["timezone_type"]=>
49        int(3)
50        ["timezone"]=>
51        string(3) "UTC"
52      }
53    }
54  }
55}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/optins"
 4)
 5
 6result, err := optins.Getlist(client, &ticketmatic.OptInQuery{
 7    Filter: "SELECT id FROM tm.optins WHERE typeid = 40001",
 8    Includearchived: true,
 9    Lastupdatesince: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
10})
11
12// The query object is optional, it can be omitted when empty.
13result, err := optins.Getlist(client, nil)

Response

 1result := optins.&List{
 2    Data: []*ticketmatic.OptIn{
 3        &ticketmatic.OptIn{
 4            Id: 123,
 5            Typeid: 40001,
 6            Name: "Marketing e-mails",
 7            Availability: []*ticketmatic.OptInAvailability{
 8                &ticketmatic.OptInAvailability{
 9                    Saleschannelid: 1,
10                },
11                &ticketmatic.OptInAvailability{
12                    Saleschannelid: 2,
13                },
14            },
15            Caption: "I do not wish to receive e-mails.",
16            Description: "Receive marketing related communications",
17            Nocaption: "No thanks.",
18            Yescaption: "Yes, I would like to receive marketing related communications.",
19            Isarchived: false,
20            Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
21            Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2014-09-26 15:24:36")),
22        },
23    },
24}

Request

1GET /api/1/{accountname}/settings/system/optins HTTP/1.1

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "data": [
 6        {
 7            "id": 123,
 8            "typeid": 40001,
 9            "name": "Marketing e-mails",
10            "availability": [
11                {
12                    "saleschannelid": 1
13                },
14                {
15                    "saleschannelid": 2
16                }
17            ],
18            "caption": "I do not wish to receive e-mails.",
19            "description": "Receive marketing related communications",
20            "nocaption": "No thanks.",
21            "yescaption": "Yes, I would like to receive marketing related communications.",
22            "isarchived": false,
23            "createdts": "2014-09-26 15:24:36",
24            "lastupdatets": "2014-09-26 15:24:36"
25        }
26    ]
27}

Parameters

FieldDescription
filter
        </td>
        <td class="description">
            <p>Filter the returned items by specifying a query on the public datamodel that returns the ids.</p> 
            <strong>Example value:</strong><code>&#34;SELECT id FROM tm.optins WHERE typeid = 40001&#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> 
            <strong>Example value:</strong><code>true</code>
        </td>
    </tr><tr>
        <td class="field">
            <div class="name">lastupdatesince</div>
            
        </td>
        <td class="description">
            <p>All items that were updated since this timestamp will be returned. Timestamp should be passed in <code>YYYY-MM-DD hh:mm:ss</code> format.</p> 
            <strong>Example value:</strong><code>&#34;2014-09-26 15:24:36&#34;</code>
        </td>
    </tr>
</tbody>

Type reference: OptInQuery

Result fields

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

FieldDescription
id
int

Unique ID

Example value:123
typeid
int

Type of the opt-in. Can be ‘Mandatory’ (40001) or ‘Optional’ (40002)

Example value:40001
name

Name

Example value:"Marketing e-mails"
availability

Sales channel where this opt-in is available

Example value:[ { "saleschannelid": 1 }, { "saleschannelid": 2 } ]
caption

Caption for the checkbox, needs to be set when typeid is Optional (40002)

Example value:"I do not wish to receive e-mails."
description

Description

Example value:"Receive marketing related communications"
nocaption

Caption for no radio button, needs to be set when typeid is Mandatory (40001)

Example value:"No thanks."
yescaption

Caption for yes radio button, needs to be set when typeid is Mandatory (40001)

Example value:"Yes, I would like to receive marketing related communications."
isarchived
bool

Whether or not this item is archived

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: OptIn[]