| Required role: | Admin |
| POST | /Outbound/Campaigns |
|---|
import 'package:servicestack/servicestack.dart';
class OutboundCampaignResult implements IConvertible
{
int? campaignId;
Map<String,int?>? decisions;
Map<String,int?>? queuedByChannel;
Map<String,int?>? messageStatuses;
int? duplicates;
int? noIdentity;
int? statusCode;
String? message;
OutboundCampaignResult({this.campaignId,this.decisions,this.queuedByChannel,this.messageStatuses,this.duplicates,this.noIdentity,this.statusCode,this.message});
OutboundCampaignResult.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
campaignId = json['campaignId'];
decisions = JsonConverters.fromJson(json['decisions'],'Map<String,int?>',context!);
queuedByChannel = JsonConverters.fromJson(json['queuedByChannel'],'Map<String,int?>',context!);
messageStatuses = JsonConverters.fromJson(json['messageStatuses'],'Map<String,int?>',context!);
duplicates = json['duplicates'];
noIdentity = json['noIdentity'];
statusCode = json['statusCode'];
message = json['message'];
return this;
}
Map<String, dynamic> toJson() => {
'campaignId': campaignId,
'decisions': JsonConverters.toJson(decisions,'Map<String,int?>',context!),
'queuedByChannel': JsonConverters.toJson(queuedByChannel,'Map<String,int?>',context!),
'messageStatuses': JsonConverters.toJson(messageStatuses,'Map<String,int?>',context!),
'duplicates': duplicates,
'noIdentity': noIdentity,
'statusCode': statusCode,
'message': message
};
getTypeName() => "OutboundCampaignResult";
TypeContext? context = _ctx;
}
class OutboundCampaignDevice implements IConvertible
{
String? token;
String? platform;
OutboundCampaignDevice({this.token,this.platform});
OutboundCampaignDevice.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
token = json['token'];
platform = json['platform'];
return this;
}
Map<String, dynamic> toJson() => {
'token': token,
'platform': platform
};
getTypeName() => "OutboundCampaignDevice";
TypeContext? context = _ctx;
}
class OutboundCampaignPerson implements IConvertible
{
String? phone;
String? email;
List<OutboundCampaignDevice>? devices;
bool? pushConsent;
bool? smsConsent;
bool? emailConsent;
String? payloadJson;
OutboundCampaignPerson({this.phone,this.email,this.devices,this.pushConsent,this.smsConsent,this.emailConsent,this.payloadJson});
OutboundCampaignPerson.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
phone = json['phone'];
email = json['email'];
devices = JsonConverters.fromJson(json['devices'],'List<OutboundCampaignDevice>',context!);
pushConsent = json['pushConsent'];
smsConsent = json['smsConsent'];
emailConsent = json['emailConsent'];
payloadJson = json['payloadJson'];
return this;
}
Map<String, dynamic> toJson() => {
'phone': phone,
'email': email,
'devices': JsonConverters.toJson(devices,'List<OutboundCampaignDevice>',context!),
'pushConsent': pushConsent,
'smsConsent': smsConsent,
'emailConsent': emailConsent,
'payloadJson': payloadJson
};
getTypeName() => "OutboundCampaignPerson";
TypeContext? context = _ctx;
}
class OutboundCampaignCreateRequest implements IConvertible
{
int? ownerId;
String? name;
String? lane;
String? templateKey;
String? payloadJson;
String? channelOrder;
int? holdoutPercent;
String? guardKey;
String? guardSubject;
DateTime? sendAt;
DateTime? expiresAt;
String? audienceSource;
List<OutboundCampaignPerson>? people;
OutboundCampaignCreateRequest({this.ownerId,this.name,this.lane,this.templateKey,this.payloadJson,this.channelOrder,this.holdoutPercent,this.guardKey,this.guardSubject,this.sendAt,this.expiresAt,this.audienceSource,this.people});
OutboundCampaignCreateRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ownerId = json['ownerId'];
name = json['name'];
lane = json['lane'];
templateKey = json['templateKey'];
payloadJson = json['payloadJson'];
channelOrder = json['channelOrder'];
holdoutPercent = json['holdoutPercent'];
guardKey = json['guardKey'];
guardSubject = json['guardSubject'];
sendAt = JsonConverters.fromJson(json['sendAt'],'DateTime',context!);
expiresAt = JsonConverters.fromJson(json['expiresAt'],'DateTime',context!);
audienceSource = json['audienceSource'];
people = JsonConverters.fromJson(json['people'],'List<OutboundCampaignPerson>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ownerId': ownerId,
'name': name,
'lane': lane,
'templateKey': templateKey,
'payloadJson': payloadJson,
'channelOrder': channelOrder,
'holdoutPercent': holdoutPercent,
'guardKey': guardKey,
'guardSubject': guardSubject,
'sendAt': JsonConverters.toJson(sendAt,'DateTime',context!),
'expiresAt': JsonConverters.toJson(expiresAt,'DateTime',context!),
'audienceSource': audienceSource,
'people': JsonConverters.toJson(people,'List<OutboundCampaignPerson>',context!)
};
getTypeName() => "OutboundCampaignCreateRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'stubbur_app.azurewebsites.net', types: <String, TypeInfo> {
'OutboundCampaignResult': TypeInfo(TypeOf.Class, create:() => OutboundCampaignResult()),
'Map<String,int?>': TypeInfo(TypeOf.Class, create:() => Map<String,int?>()),
'OutboundCampaignDevice': TypeInfo(TypeOf.Class, create:() => OutboundCampaignDevice()),
'OutboundCampaignPerson': TypeInfo(TypeOf.Class, create:() => OutboundCampaignPerson()),
'List<OutboundCampaignDevice>': TypeInfo(TypeOf.Class, create:() => <OutboundCampaignDevice>[]),
'OutboundCampaignCreateRequest': TypeInfo(TypeOf.Class, create:() => OutboundCampaignCreateRequest()),
'List<OutboundCampaignPerson>': TypeInfo(TypeOf.Class, create:() => <OutboundCampaignPerson>[]),
});
Dart OutboundCampaignCreateRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /Outbound/Campaigns HTTP/1.1
Host: stubbur-app.azurewebsites.net
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<OutboundCampaignCreateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel">
<AudienceSource>String</AudienceSource>
<ChannelOrder>String</ChannelOrder>
<ExpiresAt>0001-01-01T00:00:00</ExpiresAt>
<GuardKey>String</GuardKey>
<GuardSubject>String</GuardSubject>
<HoldoutPercent>0</HoldoutPercent>
<Lane>String</Lane>
<Name>String</Name>
<OwnerId>0</OwnerId>
<PayloadJson>String</PayloadJson>
<People>
<OutboundCampaignPerson>
<Devices>
<OutboundCampaignDevice>
<Platform>String</Platform>
<Token>String</Token>
</OutboundCampaignDevice>
</Devices>
<Email>String</Email>
<EmailConsent>false</EmailConsent>
<PayloadJson>String</PayloadJson>
<Phone>String</Phone>
<PushConsent>false</PushConsent>
<SmsConsent>false</SmsConsent>
</OutboundCampaignPerson>
</People>
<SendAt>0001-01-01T00:00:00</SendAt>
<TemplateKey>String</TemplateKey>
</OutboundCampaignCreateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<OutboundCampaignResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel">
<CampaignId>0</CampaignId>
<Decisions xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringint>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>0</d2p1:Value>
</d2p1:KeyValueOfstringint>
</Decisions>
<Duplicates>0</Duplicates>
<Message>String</Message>
<MessageStatuses xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringint>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>0</d2p1:Value>
</d2p1:KeyValueOfstringint>
</MessageStatuses>
<NoIdentity>0</NoIdentity>
<QueuedByChannel xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringint>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>0</d2p1:Value>
</d2p1:KeyValueOfstringint>
</QueuedByChannel>
<StatusCode>0</StatusCode>
</OutboundCampaignResult>