Create a new opt in

Content

Resource URL

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

Examples

Create a mandatory opt-in

In this example we will be creating an opt-in with a Yes/No question.

Request

 1use Ticketmatic\Endpoints\Settings\System\Optins;
 2
 3$result = Optins::create($client, array(
 4    "typeid" => 40001,
 5    "name" => "Newsletter",
 6    "availability" => array(
 7        array(
 8            "saleschannelid" => 2,
 9        ),
10    ),
11    "description" => "Receive marketing related info via e-mail",
12    "nocaption" => "No thanks.",
13    "yescaption" => "Yes, I would like to receive marketing related information via e-mail.",
14));

Response

 1object(\Ticketmatic\Model\OptIn) (10) {
 2  ["id"]=>
 3  int(0)
 4  ["typeid"]=>
 5  int(0)
 6  ["name"]=>
 7  string(10) "Newsletter"
 8  ["availability"]=>
 9  array(1) {
10    [0]=>
11    object(\Ticketmatic\Model\OptInAvailability) (1) {
12      ["saleschannelid"]=>
13      int(0)
14    }
15  }
16  ["description"]=>
17  string(41) "Receive marketing related info via e-mail"
18  ["nocaption"]=>
19  string(10) "No thanks."
20  ["yescaption"]=>
21  string(70) "Yes, I would like to receive marketing related information via e-mail."
22  ["isarchived"]=>
23  bool(false)
24  ["createdts"]=>
25  object(\DateTime) (3) {
26    ["date"]=>
27    string(26) "2018-04-26 13:45:11.000000"
28    ["timezone_type"]=>
29    int(3)
30    ["timezone"]=>
31    string(3) "UTC"
32  }
33  ["lastupdatets"]=>
34  object(\DateTime) (3) {
35    ["date"]=>
36    string(26) "2018-04-26 13:45:11.000000"
37    ["timezone_type"]=>
38    int(3)
39    ["timezone"]=>
40    string(3) "UTC"
41  }
42}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/optins"
 4)
 5
 6result, err := optins.Create(client, &ticketmatic.OptIn{
 7    Typeid: 40001,
 8    Name: "Newsletter",
 9    Availability: []*ticketmatic.OptInAvailability{
10        &ticketmatic.OptInAvailability{
11            Saleschannelid: 2,
12        },
13    },
14    Description: "Receive marketing related info via e-mail",
15    Nocaption: "No thanks.",
16    Yescaption: "Yes, I would like to receive marketing related information via e-mail.",
17})

Response

 1result := &ticketmatic.OptIn{
 2    Id: 13894,
 3    Typeid: 40001,
 4    Name: "Newsletter",
 5    Availability: []*ticketmatic.OptInAvailability{
 6        &ticketmatic.OptInAvailability{
 7            Saleschannelid: 2,
 8        },
 9    },
10    Description: "Receive marketing related info via e-mail",
11    Nocaption: "No thanks.",
12    Yescaption: "Yes, I would like to receive marketing related information via e-mail.",
13    Isarchived: false,
14    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2018-04-26 13:45:11")),
15    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2018-04-26 13:45:11")),
16}

Request

 1POST /api/1/{accountname}/settings/system/optins HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 40001,
 6    "name": "Newsletter",
 7    "availability": [
 8        {
 9            "saleschannelid": 2
10        }
11    ],
12    "description": "Receive marketing related info via e-mail",
13    "nocaption": "No thanks.",
14    "yescaption": "Yes, I would like to receive marketing related information via e-mail."
15}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 13894,
 6    "typeid": 40001,
 7    "name": "Newsletter",
 8    "availability": [
 9        {
10            "saleschannelid": 2
11        }
12    ],
13    "description": "Receive marketing related info via e-mail",
14    "nocaption": "No thanks.",
15    "yescaption": "Yes, I would like to receive marketing related information via e-mail.",
16    "isarchived": false,
17    "createdts": "2018-04-26 13:45:11",
18    "lastupdatets": "2018-04-26 13:45:11"
19}

Create an optional opt-in

In this example we will be creating an opt-out.

Request

 1use Ticketmatic\Endpoints\Settings\System\Optins;
 2
 3$result = Optins::create($client, array(
 4    "typeid" => 40002,
 5    "name" => "Event mails and ticket offers",
 6    "availability" => array(
 7        array(
 8            "saleschannelid" => 2,
 9        ),
10    ),
11    "caption" => "If you would prefer NOT to receive these please tick this box.",
12    "description" => "From time to time we will send out information by e-mail about similar events and tickets offers.",
13));

Response

 1object(\Ticketmatic\Model\OptIn) (9) {
 2  ["id"]=>
 3  int(0)
 4  ["typeid"]=>
 5  int(0)
 6  ["name"]=>
 7  string(29) "Event mails and ticket offers"
 8  ["availability"]=>
 9  array(1) {
10    [0]=>
11    object(\Ticketmatic\Model\OptInAvailability) (1) {
12      ["saleschannelid"]=>
13      int(0)
14    }
15  }
16  ["caption"]=>
17  string(62) "If you would prefer NOT to receive these please tick this box."
18  ["description"]=>
19  string(97) "From time to time we will send out information by e-mail about similar events and tickets offers."
20  ["isarchived"]=>
21  bool(false)
22  ["createdts"]=>
23  object(\DateTime) (3) {
24    ["date"]=>
25    string(26) "2018-04-26 13:45:11.000000"
26    ["timezone_type"]=>
27    int(3)
28    ["timezone"]=>
29    string(3) "UTC"
30  }
31  ["lastupdatets"]=>
32  object(\DateTime) (3) {
33    ["date"]=>
34    string(26) "2018-04-26 13:45:11.000000"
35    ["timezone_type"]=>
36    int(3)
37    ["timezone"]=>
38    string(3) "UTC"
39  }
40}

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/optins"
 4)
 5
 6result, err := optins.Create(client, &ticketmatic.OptIn{
 7    Typeid: 40002,
 8    Name: "Event mails and ticket offers",
 9    Availability: []*ticketmatic.OptInAvailability{
10        &ticketmatic.OptInAvailability{
11            Saleschannelid: 2,
12        },
13    },
14    Caption: "If you would prefer NOT to receive these please tick this box.",
15    Description: "From time to time we will send out information by e-mail about similar events and tickets offers.",
16})

Response

 1result := &ticketmatic.OptIn{
 2    Id: 13895,
 3    Typeid: 40002,
 4    Name: "Event mails and ticket offers",
 5    Availability: []*ticketmatic.OptInAvailability{
 6        &ticketmatic.OptInAvailability{
 7            Saleschannelid: 2,
 8        },
 9    },
10    Caption: "If you would prefer NOT to receive these please tick this box.",
11    Description: "From time to time we will send out information by e-mail about similar events and tickets offers.",
12    Isarchived: false,
13    Createdts: ticketmatic.NewTime(ticketmatic.MustParseTime("2018-04-26 13:45:11")),
14    Lastupdatets: ticketmatic.NewTime(ticketmatic.MustParseTime("2018-04-26 13:45:11")),
15}

Request

 1POST /api/1/{accountname}/settings/system/optins HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 40002,
 6    "name": "Event mails and ticket offers",
 7    "availability": [
 8        {
 9            "saleschannelid": 2
10        }
11    ],
12    "caption": "If you would prefer NOT to receive these please tick this box.",
13    "description": "From time to time we will send out information by e-mail about similar events and tickets offers."
14}

Response

 1HTTP/1.1 200 OK
 2Content-Type: application/json
 3
 4{
 5    "id": 13895,
 6    "typeid": 40002,
 7    "name": "Event mails and ticket offers",
 8    "availability": [
 9        {
10            "saleschannelid": 2
11        }
12    ],
13    "caption": "If you would prefer NOT to receive these please tick this box.",
14    "description": "From time to time we will send out information by e-mail about similar events and tickets offers.",
15    "isarchived": false,
16    "createdts": "2018-04-26 13:45:11",
17    "lastupdatets": "2018-04-26 13:45:11"
18}

Request body fields

FieldDescription
typeid
int 
(required)

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

Example value:40001
name
mlstring 
(required)

Name

Example value:"Marketing e-mails"
availability
OptInAvailability[] 
(required)

Sales channel where this opt-in is available

Example value:[ { "saleschannelid": 1 }, { "saleschannelid": 2 } ]
caption
mlstring 
(required)

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

Example value:"I do not wish to receive e-mails."
description
mlstring 
(required)

Description

Example value:"Receive marketing related communications"
nocaption
mlstring 
(required)

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

Example value:"No thanks."
yescaption
mlstring 
(required)

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."

Type reference: OptIn

Result fields

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