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.

...

GET URL: https://api.ongage.net/<list_idid>/api/segments/1112223334

Code Block
{
   "metadata": {
       "error": false
   },
   "payload": {
        "id": "12345",
        "list_id": "12345",
        "name": "list fields segment",
        "type": "Active",
        "description": "",
        "favorite": "0",
        "last_count": "345",
        "last_count_date": "1502005048",
        "last_count_request_date": null,
        "isp_breakdown": "",
        "last_sent": "0",
        "segment_quota": "0",
        "is_quota_percent": "0",
        "created_by": "1234",
        "created": "1502005048",
        "modified_by": "1234",
        "modified": "1502005048",
        "user_modified": "1502005048",
        "deleted": "0",
        "included_segment_cache": null,
        "excluded_segment_cache": null,
        "default_include_segment": "0",
        "default_exclude_segment": "0",
        "is_external": "0",
        "external_url": null,
        "external_insert_missing": "0",
        "external_include_unsubscribes": "0",
        "rules": [
        {
            "id": "1234",
            "segment_id": "12345",
            "position": "0",
            "left_parenthesis": "0",
            "field_id": "63337",
            "field_name": "email",
            "operator": "=",
            "operand": "[\"test@test.test\"]",
            "is_external_operand": "0",
            "right_parenthesis": "0",
            "condition": "and",
            "case_sensitive": "0",
            "type": "email",
            "group": ""
        },
        {
            "id": "5678",
            "segment_id": "12345",
            "position": "1",
            "left_parenthesis": "0",
            "field_id": "63347",
            "field_name": "product_id",
            "operator": ">",
            "operand": "[\"12345\"]",
            "is_external_operand": "0",
            "right_parenthesis": "0",
            "condition": "and",
            "case_sensitive": "0",
            "type": "numeric",
            "group": ""
        },
        {
            "id": "2696",
            "segment_id": "64548",
            "position": "2",
            "left_parenthesis": "0",
            "field_id": "63555",
            "field_name": "date",
            "operator": "=",
            "operand": "[1502966280]",
            "is_external_operand": "0",
            "right_parenthesis": "0",
            "condition": "and",
            "case_sensitive": "1",
            "type": "date_absolute",
            "group": ""
        }
        ],
        "mailings": [],
        "can_delete": true
      }
   }

Response Example - System Fields Segment:

...

Throws

  • HTTP_Exception_403
  • HTTP_Exception_404

GET /api/segments

Description 

This method fetches a collection of segments.

Request

list_id

Optional integer - List ID

sort

Optional string - Segment column name

order

Optional string - "ASC" or "DESC"

offset

Optional integer

limit

Optional integer

Response

GET URL: https://api.ongage.net/<list_id>/api/segments

Code Block
{
 "metadata": {
    
  "error": false,
  "total":"2"
 },

  "payload":[
{     {
   "id": "1234535114",
        ""list_id": "1234523939",
   "list_name":"My List",
   "name": "listMy fieldssegment segment1",
        "type": "Active",
   
    "description":"Description for segment"",
        "favorite": "0",
    
   "last_countsent": "3451403796208",
    
   "last_count_date": "1502005048214",
        "last_count_request_date": null,
 "1403796208",
      "ispcreated_breakdownby": "868",
 
      "last_sent"created": "01403796208",
    
   "segment_quotamodified": "01403796208",
        "is_quota_percent"deleted": "0",
    
   "created_bymodifier":"John "1234Doe",
  },
  {
   "createdid": "150200504834939",
    "list_id":"23939",
   "modifiedlist_byname":"My "1234List",
   "name":"My segment 2",
   "modifiedtype": "1502005048Active",
        "user_modified"description": "1502005048",
    
   "deletedfavorite": "0",
   "last_sent":"1403016334",
    "includedlast_segment_cachecount": null"99",
        "excluded_segment_cache": null,
    "last_count_date":"1403016334",
   "defaultcreated_include_segmentby": "0868",
        "default_exclude_segment"created": "01403016334",
        "is_external"modified": "01403016334",

       "external_url": null,
        "external_insert_missing": "deleted":"0",
    
   "external_include_unsubscribesmodifier": "0",
        "rules": [
           {
                "id": "2697",
                "segment_id": "64549",
                "position": "0",
                "left_parenthesis": "0",
                "field_id": "0",
                "field_name": "ocx_created_date",
                "operator": "<=",
                "operand": "[\"13\"]",
                "is_external_operand": "0",
                "right_parenthesis": "0",
                "condition": "and",
                "case_sensitive": "0",
                "type": "date_relative",
                "group": ""
            },
John Doe"
  }
 ]
}

POST /api/segments

Description 

This method is used to create a segment.

Request

list_id

Optional number - The list id to which the segment should be saved under. Default - Default list ID

name

Required string - Segment name

type

Required string - Segment type (Active / Deleted)

is_whitelist

Optional boolean - Flag the segment as Whitelist Segment -this segment stakeholders will receive the campaign message under all circumstances

description

Optional string - Segment description

favorite

Optional boolean - Flag the segment as favorite

is_external

Optional boolean - External segment

external_url

Optional string - The URL from which to retrieve the external segment The 'criteria' parameter needs to be provided as empty with such segments. Once the segment is created, it can only be used as a campaign segment.

external_insert_missing

Optional boolean - Flag that equals TRUE if contacts not appearing on our database should be added (default FALSE)

external_include_unsubscribes

Optional boolean - Flag that equals TRUE if unsubscribed contacts should be included in the segment (default FALSE)

criteria

Optional array - Segment rules criteria should include an array of segment rules, having:

  • field_id / field_name / conversion_point_id (field_name or conversion_point_id is required for behavioral criteria)
  • type ("email" / "string" / "numeric" / "date_absolute" / "date_relative" / "behavioral" / "segment")
  • operator ("LIKE" / "NOT LIKE" / "_LIKE" / "LIKE_" / "empty" / "notempty" / "=" / "!=" / "><" / ">" / "<" / ">=" / "<=" )
  • operand (array of values)
  • condition (and / or)

(warning) Important: In case segment is a Whitelist Segment - the only allowed criteria type is "email" and the only allowed operator is "=".

Request Example - Creating segment with 2 rules

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

  • Email contains "gmail"
  • Birth Date before 10/01/1988
Code Block
{
   "name":"My segment",
   "type":"Active",
   "description":"This is my segment",
   "criteria":[
      {
         "field_id":1234, // {Email
         "type":"email",
         "idposition": "2698",0,
         "operator":"LIKE",
         "segment_idoperand":[
"64549",            "gmail"
    "position": "1",    ],
            "left_parenthesis"condition": "0"and"
      },
      {
         "field_id": "0"1235, // Birthdate
              "field_name": "ocx_unsubscribe_date",
      "position":1,
         "operator": "=<",
         "type":"date_absolute",
         "operand": "[1503705600]",
            884404800
   "is_external_operand": "0",                 "right_parenthesis": "0",
],
               "condition": "and",
      }
         "case_sensitive": "0",
                "type": "date_absolute",
                "group": ""
            },
            {
                "id": "2699",
                "segment_id": "64549",
                "position": "2",
                "left_parenthesis": "0",
                "field_id": "0",
                "field_name": "ocx_resubscribe_date",
                "operator": ">=",
                "operand": "[1503705600]",
                "is_external_operand": "0",
                "right_parenthesis": "0",
                "condition": "and",
                "case_sensitive": "0",
                "type": "date_absolute",
                "group": ""
            },
            {
               "id": "2700",
               "segment_id": "64549",
               "position": "3",
               "left_parenthesis": "0",
               "field_id": "0",
               "field_name": "ocx_import_id",
     ]
}

Notice

Any configuration that does not follow the above requirements, will not be supported by GUI.

Error Codes

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

Request

list_id

Optional number - The list id to which the segment should be saved under. Default - Default list ID

name

Required string - Segment name

type

Required string - Segment type (Active / Deleted)

is_whitelist

Optional boolean - Flag the segment as Whitelist Segment -this segment stakeholders will receive the campaign message under all circumstances

description

Optional string - Segment description

favorite

Optional boolean - Flag the segment as favorite

criteria

Optional array - Segment rules criteria should include an array of segment rules, having:

  • field_id / field_name / conversion_point_id (field_name or conversion_point_id is required for behavioral criteria)
  • type ("email" / "string" / "numeric" / "date_absolute" / "date_relative" / "behavioral" / "segment")
  • operator ("LIKE" / "NOT LIKE" / "_LIKE" / "LIKE_" / "empty" / "notempty" / "=" / "!=" / "><" / ">" / "<" / ">=" / "<=" )
  • operand (array of values)
  • condition (and / or)

(warning) Important: In case segment is a Whitelist Segment - the only allowed criteria type is "email" and the only allowed operator is "=".

(warning) For code examples see POST /api/segments method additional examples on this page.

Notice

Any configuration that does not follow the above requirements, will not be supported by GUI.

Error Codes

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

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

Code Block
{
   "recipients":[
      {
         "email":"jane.doe1@somedomain.com",
         "operatorfirst_name": "=Jane",
         "last_name":"Doe-1"
     "operand": "[\"13\",\"23456\"]", },
      {
         "is_external_operandemail": "0" jane.doe2@somedomain.com ",
               "right_parenthesis"first_name": "0Jane",
         "last_name":"Doe-2"
     "condition": "and", },
      {
         "case_sensitiveemail":" jane.doe3@somedomain.com"0",
               "type"first_name": "numericJane",
               "group": ""
     "last_name":"Doe-3"
      },
      {
 ],         "mailingsemail": []," jane.doe4@somedomain.com ",
         "canfirst_deletename": true
      }
   }

Response Example - Behavioral Segment

Code Block
{
   "metadata": {"Jane",
         "errorlast_name": false
   },
   "payload": {"Doe-4"
      }
  "id": "12345",
        "list_id": "12345",
        "name": "list fields segment",
        "type": "Active",
        "description": "", ]
}

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:

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

Code Block
{
   "metadata": {
        "favoriteerror": "0",false
    },
   "last_countpayload": "345",{
        "last_count_dateid": "150200504812345",
        "last_count_request_datelist_id": null"12345",
        "isp_breakdownname": ""list fields segment",
        "last_senttype": "0Active",
        "segment_quotadescription": "0",
        "is_quota_percentfavorite": "0",
        "createdlast_bycount": "1234345",
        "createdlast_count_date": "1502005048",
        "modified_bylast_count_request_date": "1234"null,
        "modifiedisp_breakdown": "1502005048",
        "userlast_modifiedsent": "15020050480",
        "deletedsegment_quota": "0",
        "includedis_segmentquota_cachepercent": null"0",
        "excludedcreated_segment_cacheby": null"1234",
        "default_include_segmentcreated": "01502005048",
        "defaultmodified_exclude_segmentby": "01234",
        "is_externalmodified": "01502005048",
        "externaluser_urlmodified": null"1502005048",
        "external_insert_missingdeleted": "0",
        "externalincluded_includesegment_unsubscribescache": "0"null,
        "rulesexcluded_segment_cache": [null,
          {
   "default_include_segment": "0",
         "iddefault_exclude_segment": "27010",
 
           "segmentis_idexternal": "645500",
        "external_url": null,
    "position    "external_insert_missing": "0",
    
        "leftexternal_include_parenthesisunsubscribes": "0",
    
        "field_idrules": "0",[
           {
 "field_name": "sent",              "operatorid": "=2697",
             "operand   "segment_id": {"64549",
                 "mailing_idsposition": ["0",
                     "84715"left_parenthesis": "0",
                     "84668"field_id": "0",
                     "84666""field_name": "ocx_created_date",
                 ]"operator": "<=",
                 "esp_connection_idsoperand": "[\"13\"]",
                 "timeis_external_rangeoperand": []"0",

                "repeatright_parenthesis": {
    "0",
                "operatorcondition": "<and",
                     "counter""case_sensitive": "50",
                 }"type": "date_relative",
                "group": "browsers": [],
            },
         "countries": [],
   {
                "platformsid": [] "2698",
                },"segment_id": "64549",
                "is_external_operandposition": "01",
                "rightleft_parenthesis": "0",
                "conditionfield_id": "and0",
                "casefield_sensitivename": "0ocx_unsubscribe_date",
                "typeoperator": "behavioral=",
                "groupoperand": "[1503705600]",
          },         "is_external_operand": "0",
  {              "idright_parenthesis": "27020",
             "segment_id   "condition": "64550and",
                "positioncase_sensitive": "10",
             "left_parenthesis   "type": "0date_absolute",
                "field_idgroup": "0",
             "field_name": "opened",},
            {
  "operator": "!=",              "operandid": {
 "2699",
                "mailingsegment_idsid": ["64549",
                     "position": "847152",
                     "left_parenthesis": "846680",
                     "field_id": "846660",
                  ]"field_name": "ocx_resubscribe_date",
                  "esp_connection_ids"operator": [">=",
                      "60129"operand": "[1503705600]",
                      "60128"is_external_operand": "0",
                     "right_parenthesis": "603670",
                  ]"condition": "and",
                  "timecase_rangesensitive": {"0",
                     "operator"type": "betweendate_absolute",
    
                "in_lastgroup": "10",
            },
        "in_last_unit": "day",    {
                 "toid": "12700",
                     "to_unit"segment_id": "month64549",
                  }"position": "3",
                  "repeat"left_parenthesis": {
     "0",
               "operatorfield_id": "<0",
    
                "counterfield_name": "5ocx_import_id",
                  }"operator": "=",
                  "browsersoperand": "[\"13\",\"23456\"]",
                     "Chrome""is_external_operand": "0",
                  ]"right_parenthesis": "0",
                  "countriescondition": ["and",
                     "AF"case_sensitive": "0",
                     "BD"type": "numeric",
               "group": ""
    "IO"          }
        ],

                 "platforms"mailings": [],
        "can_delete": true
      }
    "Linux"
}

Response Example - Behavioral Segment

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

Code Block
{
   "metadata": {
       "error": false
   },
   "payload": ]{
        "id": "12345",
   },     "list_id": "12345",
        "is_external_operandname": "0list fields segment",
    
        "right_parenthesistype": "0Active",
 
           "conditiondescription": "and",
    
        "case_sensitivefavorite": "0",
             "type"last_count": "behavioral345",
    
        "grouplast_count_date": "1502005048",
           }"last_count_request_date": null,
          {
   "isp_breakdown": "",
        "idlast_sent": "27030",
            "segment_idquota": "645500",
            "position"is_quota_percent": "20",
   
        "leftcreated_parenthesisby": "01234",
   
        "field_idcreated": "01502005048",

           "fieldmodified_nameby": "clicked1234",
   
        "operatormodified": "=1502005048",
        "user_modified": "1502005048",
  "operand": {     "deleted": "0",
         "mailingincluded_segment_idscache": [],
    null,
          "espexcluded_connectionsegment_idscache": [null,
        "default_include_segment": "0",
        "60129default_exclude_segment": "0",
        "is_external": "0",
    ],       "external_url": null,
        "timeexternal_insert_rangemissing": {"0",
        "external_include_unsubscribes": "0",
         "operatorrules": "custom",[
           {
       "from_date": 1501545600,     "id": "2701",
             "tosegment_dateid": 1504137600"64550",
               }"position": "0",
               "repeatleft_parenthesis": []"0",
               "browsersfield_id": []"0",
               "countriesfield_name": []"sent",
              "operator": "platforms": []=",
             "operand": {
 },                "ismailing_external_operandids": "0", [
               "right_parenthesis":      "084715",
                    "condition": "and84668",
             "case_sensitive": "0",        "84666"
                 ],
                 "typeesp_connection_ids": "behavioral",[],
                 "grouptime_range": [],
""           }      "repeat": {
  ],         "mailings": [],         "can_deleteoperator": true"<",
      }    }

Throws

  • HTTP_Exception_403
  • HTTP_Exception_404

GET /api/segments

Description 

This method fetches a collection of segments.

Request

list_id

Optional integer - List ID

sort

Optional string - Segment column name

order

Optional string - "ASC" or "DESC"

offset

Optional integer

limit

Optional integer

Response

GET URL: https://api.ongage.net/<list_id>/api/segments

Code Block
{
 "metadata":{
  "error":false,
  "total":"2"           "counter": "5"
                 },
 "payload":[        {    "id":"35114",    "list_idbrowsers":"23939", [],
      "list_name":"My List",    "name":"My segment 1",    "typecountries":"Active", [],
       "description":"Description for segment",    "favorite":"0",    "last_sentplatforms":"1403796208", []
  "last_count":"214",    "last_count_date":"1403796208",    "created_by":"868",    "created":"1403796208",},
     "modified":"1403796208",     "deleted":"0",    "modifieris_external_operand": "0"John,
Doe"   },   {    "id":"34939",    "listright_idparenthesis": "239390",
   "list_name":"My List",    "name":"My segment 2",    "typecondition": "Activeand",
   "description":"",           "favoritecase_sensitive": "0",
        "last_sent":"1403016334",      "last_counttype": "99behavioral",
   "last_count_date":"1403016334",       "created_by":"868",    "createdgroup": "1403016334",
      "modified":"1403016334",    "deleted":"0",},
     "modifier":"John Doe"   } {
]
}

POST /API/segments

Description 

This method is used to create a segment.

Request

list_id

Optional number - The list id to which the segment should be saved under. Default - Default list ID

name

Required string - Segment name

type

Required string - Segment type (Active / Deleted)

is_whitelist

Optional boolean - Flag the segment as Whitelist Segment -this segment stakeholders will receive the campaign message under all circumstances

description

Optional string - Segment description

favorite

Optional boolean - Flag the segment as favorite

is_external

Optional boolean - External segment

external_url

Optional string - The URL from which to retrieve the external segment The 'criteria' parameter needs to be provided as empty with such segments. Once the segment is created, it can only be used as a campaign segment.

external_insert_missing

Optional boolean - Flag that equals TRUE if contacts not appearing on our database should be added (default FALSE)

external_include_unsubscribes

Optional boolean - Flag that equals TRUE if unsubscribed contacts should be included in the segment (default FALSE)

criteria

Optional array - Segment rules criteria should include an array of segment rules, having:

  • field_id / field_name / conversion_point_id (field_name or conversion_point_id is required for behavioral criteria)
  • type ("email" / "string" / "numeric" / "date_absolute" / "date_relative" / "behavioral" / "segment")
  • operator ("LIKE" / "NOT LIKE" / "_LIKE" / "LIKE_" / "empty" / "notempty" / "=" / "!=" / "><" / ">" / "<" / ">=" / "<=" )
  • operand (array of values)
  • condition (and / or)

(warning) Important: In case segment is a Whitelist Segment - the only allowed criteria type is "email" and the only allowed operator is "=".

Request Example - Creating segment with 2 rules

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

  • Email contains "gmail"
  • Birth Date before 10/01/1988
Code Block
{
   "name":"My segment",
   "type":"Active",
   "description":"This is my segment",
   "criteria":[
      {             "id": "2702",
             "segment_id": "64550",
             "position": "1",
             "left_parenthesis": "0",
             "field_id": "0",
             "field_name": "opened",
             "operator": "!=",
             "operand": {
                  "mailing_ids": [
                      "84715",
                      "84668",
                      "84666"
                  ],
                  "esp_connection_ids": [
                      "60129",
                      "60128",
                      "60367"
                  ],
                  "time_range": {
                     "operator": "between",
                     "in_last": "10",
                     "in_last_unit": "day",
               "field_id":1234, // Email          "typeto": "email1",
           "position":0,          "operatorto_unit": "LIKEmonth",
         "operand":[         },
   "gmail"          ],          "conditionrepeat":"and" {
     },       {          "field_idoperator":1235 "<",
// Birthdate          "position":1,          "operatorcounter": "<5",
           "type":"date_absolute",       },
                  "operandbrowsers": [
            884404800         "Chrome"
                  ],
                  "conditioncountries":"and" [
                     "AF",
              }      ]
}

Notice

Any configuration that does not follow the above requirements, will not be supported by GUI.

Error Codes

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

Request

list_id

Optional number - The list id to which the segment should be saved under. Default - Default list ID

name

Required string - Segment name

type

Required string - Segment type (Active / Deleted)

is_whitelist

Optional boolean - Flag the segment as Whitelist Segment -this segment stakeholders will receive the campaign message under all circumstances

description

Optional string - Segment description

favorite

Optional boolean - Flag the segment as favorite

criteria

Optional array - Segment rules criteria should include an array of segment rules, having:

  • field_id / field_name / conversion_point_id (field_name or conversion_point_id is required for behavioral criteria)
  • type ("email" / "string" / "numeric" / "date_absolute" / "date_relative" / "behavioral" / "segment")
  • operator ("LIKE" / "NOT LIKE" / "_LIKE" / "LIKE_" / "empty" / "notempty" / "=" / "!=" / "><" / ">" / "<" / ">=" / "<=" )
  • operand (array of values)
  • condition (and / or)

(warning) Important: In case segment is a Whitelist Segment - the only allowed criteria type is "email" and the only allowed operator is "=".

(warning) For code examples see POST /api/segments method above.

Notice

Any configuration that does not follow the above requirements, will not be supported by GUI.

Error Codes

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

Code Block
{
   "recipients":[
      { "BD",
                     "IO"
                  ],
                  "platforms": [
                     "Linux"
                  ]
             },
             "is_external_operand": "0",
             "right_parenthesis": "0",
             "condition": "and",
             "case_sensitive": "0",
             "type": "behavioral",
             "group": ""
           },
          {
            "id": "2703",
            "segment_id": "64550",
            "position": "2",
            "left_parenthesis": "0",
            "field_id": "0",
            "field_name": "clicked",
            "operator": "=",
            "operand": {
               "mailing_ids": [],
               "esp_connection_ids": [
                 "60129"
               ],
               "time_range": {
                   "operator": "custom",
                   "from_date": 1501545600,
                   "email":"jane.doe1@somedomain.com"to_date": 1504137600
               },
         "first_name":"Jane"      "repeat": [],
         "last_name":"Doe-1"      "browsers": [],
                }"countries": [],
      {          "emailplatforms":" jane.doe2@somedomain.com ", []
            },
            "firstis_external_nameoperand": "Jane0",
            "lastright_nameparenthesis": "Doe-20",
      },      "condition": "and",
 {           "emailcase_sensitive":" jane.doe3@somedomain.com "0",
         "first_name   "type": "Janebehavioral",
            "last_namegroup": "Doe-3"
      },    }
  {          "email":" jane.doe4@somedomain.com ",
],
        "first_namemailings":"Jane",
 [],
        "last_name":"Doe-4"can_delete": true
      }

  ] }

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

...

Request Example - Creating segment with rule that includes multiple values

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

...

Code Block
{
   "name":"My segment",
   "type":"Active",
      "description":"This is my segment",
   "criteria":[
      {
         "field_id":1234, // First name
         "type":"string",
         "position":0,
         "operator":"LIKE",
         "case_sensitive":"1",
         "operand":[
            "James",
            "Peter",
            "David"
         ],
         "condition":"and"
      }
   ]
}

...

Request Example - Creating segment with OR Groups

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

...

Code Block
{
   "name":"My Group segment",
   "type":"Active",
      "description":"This is my segment",
   "criteria":[
      {
         "field_id":1233, // Email
         "type":"string",
         "position":0,
         "operator":"LIKE",
         "operand":[
            "@gmail"
         ],
         "condition":"and"
      },
      {
         "field_id":1234, // First name
         "type":"string",
         "group":"First name or last name or address",
         "position":1,
         "left_parenthesis":1,
         "operator":"notempty",
         "condition":"and"
      },
      {
         "field_id":1235, // Last name
         "type":"string",
         "group":"First name or last name or address",
         "position":1,
         "operator":"notempty",
         "condition":"or"
      },
      {
         "field_id":1236, // Address
         "type":"string",
         "group":"First name or last name or address",
         "position":2,
         "right_parenthesis":1,
         "operator":"notempty",
         "condition":"or"
      }
   ]
}

...

Request Example - Creating behavioral segment - operand options

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

...

Code Block
{
   "name":"Behavioral Segment",
   "type":"Active",
   "criteria":[
      {
         "type":"behavioral",
         "position":1,
         "field_name":"opened",
         "operator":"=",
         "operand":{
            "mailing_ids":[
               85362,
               85360
            ],
            "esp_connection_ids":[
               60133,
               60387
            ],
            "time_range":{
               "operator":"between",
               "in_last":30,
               "in_last_unit":"day",
               "to":2,
               "to_unit":"month"
            },
            "browsers":[
               "Chrome"
            ],
            "countries":[
               "AZ",
               "BH"
            ],
            "platforms":[
               "Linux",
               "Win8.1"
            ]
         },
         "condition":"and"
      },
      {
         "type":"behavioral",
         "position":1,
         "field_name":"clicked",
         "operator":"=",
         "operand":{
            "time_range":{
               "operator":  "custom",
               "from_date": 2017-02-01 10:30:00,
               "to_date":   2017-02-23 10:30:00
            }
         },
         "condition":"and"
      }
   ]
}

...

Request Example - Creating a Segment Based on the Ongage Import ID

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

Code Block
{
   "name":"Segment Based on Import ID",
   "type":"Active",
   "description":"Segment based on Import ID",
   "criteria":[
      {
         "condition":"and",
         "field_name":"ocx_import_id",
         "type":"numeric",
         "position":0,
         "operator":"=",
         "operand":[
            "11111111"
         ]
      }
   ]
}

...

Request Example - Creating Whitelist Segment - operand options

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

Code Block
{
   "name":"Whitelist Segment",
   "type":"Active",
   "description":"This is a Whitelist Segment",
   "is_whitelist": true,
   "criteria":[
      {
         "field_id":1234, // Email
         "type":"email",
         "position":0,
         "operator":"=",
         "operand":[
            "james@test.com",
            "peter@test.com",
            "david@test.com"
         ],
         "condition":"and"
      }
   ]
}

...

Request Example - Creating segment with date relative rules

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

...