Table of Contents:
Table of Contents minLevel 2
Intro
Info |
---|
The Mailing API gives you access to all your mailing campaigns in your account. |
Note: Notice that in each API call you must provide the List ID that you are working on, otherwise the default List ID will be used.
Methods Summary
GET /api/mailings/<Campaign ID>
Description
This method fetches a single mailing, including email messages, segments and distribution.
...
Campaign Status Codes
Status | Code |
---|---|
NEW | 60001 |
SCHEDULED | 60002 |
IN_PROGRESS | 60003 |
COMPLETED | 60004 |
ERROR | 60005 |
CANCELLED | 60006 |
DELETED | 60007 |
COMPLETED_WITH_ERRORS | 60008 |
ON_HOLD | 60009 |
STOPPED | 60010 |
GET /api/mailings
Description
This method gives collection of campaigns in response.
...
Optional int
limit
Optional int
POST /api/mailings
Description
This method creates a new mailing campaign. If "schedule_date" is provided (as Unix timestamp), campaign will be scheduled. Otherwise if none provided it will launch immediately.
...
- 400 - Invalid data in request
403 - Permission error
404 - Campaign not found
PUT /api/mailings/<Campaign ID>
Description
This method updates an existing mailing campaign. If schedule_date is provided (as Unix timestamp), campaign will be scheduled.
...
- 400 - Invalid data in request
403 - Permission error
404 - Campaign not found
PUT /api/mailings/<Campaign ID>/abort
Description
This method is used to toggle campaign status On Hold / Stopped / In Progress.
...
403 - Permission error
404 - Campaign not found
PUT /api/mailings/<Campaign ID>/cancel
Description
This method is used to cancel/delete an existing mailing campaign.
...
403 - Permission error
404 - Campaign not found
PUT /api/mailings/<Campaign ID>/unschedule
Description
This method is used to Un-schedule a campaign. This will set the campaign status to "New".
...
403 - Permission error
404 - Campaign not found
PUT /api/mailings/<Campaign ID>/revive
Description
This method Revives a canceled/deleted campaign.
Additional Examples
Request Example - Regular campaign request sample with ESP connection/domain distribution
POST URL: https://api.ongage.net/<list_id>/api/mailings
...
Code Block |
---|
{ "name": "New campaign with domain distribution", "description": "Handle with care", "email_message": [ 27 ], "segments": [ 1429 ], "distribution": [ { "esp_connection_id": 12345, "percent": 100, "domain": "gmail.com" }, { "esp_connection_id": 67890, "percent": 100, "domain": "default" } ] } |
Request Example - Regular campaign request sample with ESP connection / segments distribution
POST URL: https://api.ongage.net/<list_id>/api/mailings
...
Code Block |
---|
{ "name": "New campaign with segments distribution", "description": "Handle with care", "email_message": [ 27 ], "segments": [ 1429, 1428 ], "distribution": [ { "esp_connection_id": 12345, "percent": 100, "segment_id": 1429 }, { "esp_connection_id": 67890, "percent": 100, "segment_id": 1428 } ] } |
Request Example - Split campaign request sample
POST URL: https://api.ongage.net/<list_id>/api/mailings
Code Block |
---|
{ "type": "split", "split_type": "email", "name": "Split 2 email messages 50/50 to 1 Segment using 1 Sender Connection", "email_message": [ "953", "954" ], "segments": [ "31448" ], "distribution": [ { "esp_connection_id":"12345", "percent":"100" } ], "schedule_date": "2018-11-30 08:24", "notify_onlaunch": "0", "notify_onfailed": "0", "notify_oncomplete": "0" } |
Request Example - Split campaign request sample with winner sent after 24 hours
POST URL: https://api.ongage.net/<list_id>/api/mailings
Code Block |
---|
{ "name":"A/B Split Test client scenario", "split_type":"email", "email_message":[ "12344", "54467" ], "whitelist_segment_ids":null, "segments":[ "123454", "764634" ], "esp_optional_routes":"segment", "segment_esp_distribution_by":"quota", "distribution":[ { "segment_id":"123454", "esp_connection_id":"76644" }, { "segment_id":"764634", "esp_connection_id":"98875" } ], "time_to_send_config":{ "delivery_timing_type":"schedule_date" }, "schedule_date":"01/12/2021 17:15", "delivery_timing_type":"per_timezone", "schedule_hour":"17", "schedule_minute":"15", "type":"split", "has_winner_settings":true, "winner_is_quota_percent":"1", "winner_quota_value":"20", "winner_conversion_field":"unique_opens", "winner_send_after_hours":"24" // Up to and not more than 24 Hours } |
Request Example - Split campaign request sample 50/50 Split without segmentation routing
POST URL: https://api.ongage.net/<list_id>/api/mailings
Code Block |
---|
{ "name":"A/B winner Split by 50/50 without Segmentation routing", "message_type":"email_message", "split_type":"esp", "esps":[ "1233", "6577" ], "email_message":[ "12345" ], "segments":[ "1234" ], "esp_optional_routes":"single", "distribution":[ { "esp_connection_id":"1233", "isp_id":0, "percent":50 }, { "esp_connection_id":"6577", "isp_id":0, "percent":50 } ], "time_to_send_config":{ "delivery_timing_type":"schedule_date" }, "delivery_timing_type":"per_timezone", "has_winner_settings":true, "winner_is_quota_percent":"1", "winner_quota_value":"2", "winner_conversion_field":"unique_opens", "winner_send_after_hours":"1", "schedule_hour":"10", "schedule_minute":"39", "type":"split", "use_default_esp":true, "schedule_date":"01/12/2021 10:39" } |
Request Example - SMS campaign request sample
POST URL: https://api.ongage.net/<list_id>/api/mailings
Code Block |
---|
{ "name": "My new SMS campaign", "description": "Handle with care", "email_message": [ 27 ], "segments": [ 1429 ], "segments_excluded": [ 1520 ], "distribution": [ {"esp_connection_id": 19999, "percent": 100 } ], "favorite": false, "schedule_date": 1393738129 } |
Request Example - Test campaign request sample
POST URL: https://api.ongage.net/<list_id>/api/mailings
...