AssignRecipientList
Assign recipient list to the targeted campaign.
URL | https://api.enginemailer.com/restapi/campaign/emcampaign/AssignRecipientList |
Method | HTTP POST |
Please note of the following before starting use this function
- Scheduled, delivering, delivered campaign is not able to perform the assigning.
- This function will not work when the campaign is inserting / deleting the recipient list.
- The subcategoryid please get from the function which named as getSubCategoryList.
Table: Parameter(JSON)
Parameter name | Description | Column Type |
---|---|---|
CampaignID | Targeted Campaign ID. | Integer |
Data |
A list of data to assign the recipient list. This field is only required when filter by is 2. |
JSON String |
FilterBy |
Filter by category or assign all subscriber to the campaign. 1 – Assign All Subscriber 2 – Filter by Category |
Integer |
Table: Data Definition for JSON
Parameter name | Description | Column Type | Maximum Length | Required? |
---|---|---|---|---|
CategoryList | The list of sub category id | JArray (Int) |
- | Yes |
FilterType | Filter type. The value only can be AND / OR. Others value will throw the error. This is using to filter out all the subscriber which contains all the sub category listed, or any subscriber which contain one of sub category listed in the category list. | String |
128 | Yes |
Request Example
Header
<APIKEY> - Value
Body
{
"CategoryList": [1,2,3,4],
"FilterType": "OR"
}
Response
Success Response
{
"Result":{
"Status":"OK",
"StatusCode":"200"
}
}
Failed Response
{
"Result":{
"StatusCode":"500",
"Status":"InternalServerError",
"ErrorMessage":"Authentication Failed!"
}
}
Code Example (.NET)
Using REST SHARP library , please download from Nuget Package
JObject jb = new JObject();
JArray array = new JArray();
array.Add(1);
array.Add(2);
array.Add(3);
array.Add(4);
jb.Add("categorylist",array);
jb.Add("filtertype","OR");
JObject submitContent = new JObject();
submitContent.Add("data", jb);
submitContent.Add("campaignid", 1);
submitContent.Add("FilterBy", 2);
var client = new RestClient("https://api.enginemailer.com/restapi/campaign/emcampaign/AssignRecipientList");
var request = new RestRequest(Method.POST);
request.AddHeader("APIKey", "YOUR API KEY");
request.AddParameter("email", submitContent.ToString(), ParameterType.RequestBody);
var response = client.Execute(request).Content;