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 will retrieve all the campaigns in a given list based on the optional filters detailed below.

...

Code Block
{
  "metadata": {
    "error": false,
    "total": "1"
  },
  "payload": [
    {
      "id": "1234567890",
      "name": "[TEST] Ongage Support test",
      "schedule_date": "1638229112",
      "type": "campaign",
      "split_type": null,
      "status": "60004",
      "list_id": "1234567",
      "status_desc": "Completed",
      "status_date": "1638229129",
      "scheduled_by": "23913",
      "has_quota": "0",
      "split_subject_content_email_id": null,
      "created_by": "23913",
      "favorite": "0",
      "created": "1638229112",
      "modified": "1638229724",
      "deleted": "0",
      "is_test": "1",
      "progress": "100",
      "manager": "Mr. Manager",
      "targeted": "1",
      "cannot_resume": "0",
      "cannot_resume_reason": "",
      "original_email_message_id": "12345678",
      "ox_data": null,
      "sending_start_date": "1638229119",
      "sending_end_date": "1638229128",
      "estimated_sending_end_date": "0",
      "emails_limit": "0",
      "report": 1,
      "test": 0,
      "cancel": 0,
      "schedule": "delivered",
      "esps": "SparkPost",
      "comment": "",
      "email_id": "12345678",
      "email_name": "Ongage Support test 34091",
      "message_type": "email_message",
      "is_email_designer": "0"
    }
  ]
}

POST /api/mailings

Description 

This method creates a new mailing campaign. If "schedule_date" is provided (as Unix timestamp), campaign will be scheduled. 

...

*emails : integer - required when throttling_type is emails_per_day

*sto: string - Enable send time optimization, Let Ongage pick the best time to send

Notice: "time_to_send_config" is replacing the old "span_type", "span_active" and "span_value" configurations which are deprecated and soon will stop to be supported.

sto 

Optional object

Enable send time optimization, Let Ongage pick the best time to send

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

...

  • 400 - Invalid data in request
  • 403 - Permission error

  • 404 - Campaign not found

POST /api/mailings/<Campaign ID>duplicate

Description 

This method is used for duplicating Bulk campaigns. Please note that duplicating A/B Split or Test Campaign is not supported.

...

Code Block
{
  "email_message_id":123456, ///mendatory//
   "segments":[ ],  ///optional///
   "segments_excluded":[ ], ///optional///
   "add_copy_to_title": true/false, ///optional///
}


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

...