Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents:

Table of Contents
minLevel2

Intro

Info
The Mailing API gives you access to all your mailing campaigns in your account.

(info) 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

StatusCode
NEW60001
SCHEDULED60002
IN_PROGRESS60003
COMPLETED60004
ERROR60005
CANCELLED60006
DELETED60007
COMPLETED_WITH_ERRORS60008
ON_HOLD60009
STOPPED60010


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. 

...

Limit the total number of messages to be sent for this campaign

trackingkeep_segment_domainsort

Optional string

Override default tracking domain

image_domain

Optional string

Override default image domain

is_test

Optional boolean

Mark this campaign as a test campaign. - Default: FALSE

Example - Regular campaign request sample

POST URL: https://api.ongage.net/<list_id>/api/mailings

...

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

Defines Global Quota

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.

tracking_domain

Optional string

Override default tracking domain

image_domain

Optional string

Override default image domain

is_test

Optional boolean

Mark this campaign as a test campaign. - Default: FALSE

Example - Regular campaign request sample

POST URL: https://api.ongage.net/<list_id>/api/mailings

Code Block
{
   "name": "My new campaign",
   "description": "Handle with care",
   "email_message": [ 27 ],
   "segments": [ 1429 ],
   "distribution": [
     {
            "esp_connection_id": 12345 ,
            "percent": 100
     }
   ]
}

...

  • 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.

...

Code Block
// Throttling "emails_per_day" example
{
   "time_to_send_config" : {
     "delivery_timing_type" : "throttling",
     "throttling_type": "emails_per_day",
     "emails": 5000
    }
}
Code Block
// Throttling


Code Block
// Throttling "hours" example
{
   "time_to_send_config" : {
     "delivery_timing_type" : "throttling",
     "throttling_type": "hours",
     "hours": example50
  {  }
 "time_to_send_config" : {
     "delivery_timing_type" : "throttling",
     "throttling_type": "hours",
     "hours": 50
    }
}

emails_limit

Optional number

...

}

emails_limit

Optional number

Limit the total number of messages to be sent for this campaign

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

Defines Global Quota

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.

tracking_domain

Optional string

...

  • 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 -

...

Schedule Campaign to 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.

...

 "schedule_now":true
}

Request Example - Send Campaign with Segment order until quota

...

POST URL: https://api.ongage.net/<list_id>/api/mailings

Code Block
{
	"email_messagename": “example"12345",
	"nameemail_message": “example"12345",
	"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

"1233456"],
	"distribution": {
		 {
			"esp_connection_id": "122456",
			"isp_id": "0",
			"percent": "100"
		}
	},
	"emails_limit_active": true,
	"emails_limit_global_active

...

Optional boolean: True or false

*it Defines Global Quota

emails_limit

Optional numeric

...

": true,
	"emails_limit": "10"
}