Modify an existing opt in

Content

Resource URL

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

Example

Request

 1use Ticketmatic\Endpoints\Settings\System\Optins;
 2
 3$result = Optins::update($client, $id, array(
 4    "typeid" => 40001,
 5    "name" => "Marketing e-mails",
 6    "availability" => array(
 7        array(
 8            "saleschannelid" => 1,
 9        ),
10        array(
11            "saleschannelid" => 2,
12        ),
13    ),
14    "caption" => "I do not wish to receive e-mails.",
15    "description" => "Receive marketing related communications",
16    "nocaption" => "No thanks.",
17    "yescaption" => "Yes, I would like to receive marketing related communications.",
18));

Response

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

Request

 1import (
 2    "github.com/ticketmatic/tm-go/ticketmatic"
 3    "github.com/ticketmatic/tm-go/ticketmatic/settings/system/optins"
 4)
 5
 6result, err := optins.Update(client, id, &ticketmatic.OptIn{
 7    Typeid: 40001,
 8    Name: "Marketing e-mails",
 9    Availability: []*ticketmatic.OptInAvailability{
10        &ticketmatic.OptInAvailability{
11            Saleschannelid: 1,
12        },
13        &ticketmatic.OptInAvailability{
14            Saleschannelid: 2,
15        },
16    },
17    Caption: "I do not wish to receive e-mails.",
18    Description: "Receive marketing related communications",
19    Nocaption: "No thanks.",
20    Yescaption: "Yes, I would like to receive marketing related communications.",
21})

Response

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

Request

 1PUT /api/1/{accountname}/settings/system/optins/{id} HTTP/1.1
 2Content-Type: application/json
 3
 4{
 5    "typeid": 40001,
 6    "name": "Marketing e-mails",
 7    "availability": [
 8        {
 9            "saleschannelid": 1
10        },
11        {
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}

Response

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

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