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
...
Code Block |
---|
{ "is_test": true, "name": "My test campaign", "description": "My description", "email_message": [ 27 ], "recipients": [ "john@doe.com", "another@email.com" ], "esp_connection_id": 19999, "favorite": false, "prepend_test_to_subject": true } |
Request Example - Regular campaign request with Campaign Send By Timezone
POST URL: https://api.ongage.net/<list_id>/api/mailings
Code Block |
---|
{
"name": "Timezone test",
"email_message": 12343,
"segments": [45454],
"distribution": [
{
"esp_connection_id": 4453,
"percent": 100
}
],
"time_to_send_config":{
"schedule_type":"launch_now",
"send_by_timezone":{
"timezone_source":"ip",
"contact_field_id":"128296", // Add List Filed Id here
"start_timezone":"Asia/Kolkata"
},
"delivery_timing_type":"schedule_date"
},
"schedule_now":true
} |
send_by_timezone
Optional object
Define Timezone setting if you provide following fields:
*ip: float - Send by IP Address
*timezone : Send by Timezone
*zipcode : Send by ZIP Code
*airport: Send by Airport code
*contact_field_id: integer - List Field ID of the field where contacts details are added
*start_timezone: string - Starting timezone of the Campaign sent.
Request Example - Regular campaign request with Campaign with Segment order until quota:
POST URL: https://api.ongage.net/<list_id>/api/mailings
Code Block |
---|
{
"email_message": "12345",
"name": “example",
"keep_segment_sort": true,
"segments": ["1233456"],
"distribution": {
{
"esp_connection_id": "122456",
"isp_id": "0",
"percent": "100"
}
},
"emails_limit_active": true,
"emails_limit_global_active": true,
"emails_limit": "10"
} |
keep_segment_sort
Optional boolean : True or False
*Enables option to send campaign by Selected Segment order until the quota is reached.
*Note: For this option to work, Campaign “emails_limit_global_active” must be true
emails_limit_global_active
Optional boolean: True or false
*it Defines Global Quota
emails_limit
Optional numeric
*Defines number of contacts limit you want to apply in the Campaign.