Versions Compared

Key

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

Table of Contents:

Table of Contents
minLevel2


(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/segments/<Segment ID>

Description 

This method fetches a single segment including rules and associated mailings.

...

  • HTTP_Exception_403
  • HTTP_Exception_404

GET /api/segments

Description 

This method fetches a collection of segments.

...

Code Block
{
 "metadata":{
  "error":false,
  "total":"2"
 },
 "payload":[
  {
   "id":"35114",
   "list_id":"23939",
   "list_name":"My List",
   "name":"My segment 1",
   "type":"Active",
   "description":"Description for segment",
   "favorite":"0",
   "last_sent":"1403796208",
   "last_count":"214",
   "last_count_date":"1403796208",
   "created_by":"868",
   "created":"1403796208",
   "modified":"1403796208",
   "deleted":"0",
   "modifier":"John Doe"
  },
  {
   "id":"34939",
   "list_id":"23939",
   "list_name":"My List",
   "name":"My segment 2",
   "type":"Active",
   "description":"",
   "favorite":"0",
   "last_sent":"1403016334",
   "last_count":"99",
   "last_count_date":"1403016334",
   "created_by":"868",
   "created":"1403016334",
   "modified":"1403016334",
   "deleted":"0",
   "modifier":"John Doe"
  }
 ]
}

POST /api/segments

Description 

This method is used to create a segment.

...

  • 400 - Invalid call
  • 403 - Permission error
  • 404 - Not found
  • 412 - Invalid data

PUT /api/segments/<Segment ID>

Description 

This method updates segments based on id from request and also saves in segment_rules table values in criteria. It returns single row with updated details.

...

  • 400 - Invalid call
  • 403 - Permission error
  • 404 - Not found
  • 412 - Invalid data

PUT /api/segments/<Segment ID>/populate_external

Description 

This feature is designed to serve customers, that do email marketing from within their own CRM and don't need the Ongage segmentation management feature, as they do their own segmentation directly from within their CRM. After creating a segment, as an external segment (using the POST api/segments with the external flag set to true) use this method to then populate the external segment with email addresses and their accompanying dynamic list field data. For more about external segments see "What are External Segments" in our Segments documentation.

PUT URL: https://api.ongage.net/<list_id>/api/segments/1112223334/populate_external

Code Block
{
   "recipients":[
      {
         "email":"jane.doe1@somedomain.com",
         "first_name":"Jane",
         "last_name":"Doe-1"
      },
      {
         "email":" jane.doe2@somedomain.com ",
         "first_name":"Jane",
         "last_name":"Doe-2"
      },
      {
         "email":" jane.doe3@somedomain.com",
         "first_name":"Jane",
         "last_name":"Doe-3"
      },
      {
         "email":" jane.doe4@somedomain.com ",
         "first_name":"Jane",
         "last_name":"Doe-4"
      }
   ]
}

DELETE /api/segments/<Segment ID>

Description 

This method deletes a segment. By deleting segment, this method will also unschedule any scheduled campaign using this segment.

POST /api/segments/export

Description 

This endpoint is deprecated, please use POST /api/export instead.

GET /api/segments/<Export ID>/export_retrieve

Description 

This endpoint is deprecated, please use GET /api/export/<Export ID>/retrieve instead.

Additional Examples

Response Example - System Fields Segment:

...