Export API Methods

Export API Methods

Table of Contents:



 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/export/<Export ID>/retrieve

Description 

This method serves an export, creating the export may take a while

Important notice

You have to save the response as binary file. For example in PHP, use file_put_contents()

Error Codes

  • 412 - Invalid data or export is not finished yet

POST /api/export

Description 

This method is used to create an export.

Request

list_id

Optional number - List ID. Default - Default list ID

Note: For Suppression List Export, List ID is Required.

name

Required string - Export name

segment_id

Required segment_id or mailing_id array of integers - Array of Segment IDs

Note: In case of Suppression list, Segment ID is not required.

mailing_id

Required segment_id or mailing_id array of integers - Array of mailing IDs

date_format

Required string - Date fields format, available: 'mm/dd/yyyy', 'mm/dd/yy', 'mm-dd-yyyy', 'mm-dd-yy', 'dd/mm/yyyy', 'dd/mm/yy', 'dd-mm-yyyy', 'dd-mm-yy'

file_format

Required string - Available: 'csv'

fields_selected

Optional array of string - Array with the list fields name to contain in the export. Default - All list fields

Available system fields: ocx_contact_id, ocx_created_date, ocx_unsubscribe_date

status

Required array - Available: 'active', 'unjoin-member', 'clicked', 'opened', 'inactive', 'bounced', 'complaint'. bounced and complaint are available for export based on segment only

Request Example - Export segment ID 77197 and 77198

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

{ "name": "My export", "date_format": "mm/dd/yyyy", "file_format": "csv", "segment_id": [77197, 77198], "status": [ "active", "inactive" ] }

Request Example - Export mailing IDs 4452, 4458

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

{ "name": "My export", "date_format": "mm/dd/yyyy", "file_format": "csv", "mailing_id": [ 4452, 4458 ], "fields_selected": [ "email", "first_name", "last_name", "birth_date" ], "status": [ "active", "opened", "inactive" ] }

Get the Exported File

In order to get the exported ZIP file, use the export ID from response of GET api/export/<Export ID>/retrieve.

Error Codes

  • 412 - Invalid Data