Versions Compared

Key

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

Table of Contents:

Table of Contents
minLevel2

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. You can review the possible ways to provide List ID in this link.

Methods Summary

This API controller is for managing asynchronous contact activity reports.

...

  1. Create instance - Create a new contact activity report using "POST api/contact_activity" You need to set a title for this new search, and the filters used for contacts segmentation.

  2. Check the instance status - Check the contact search status using "GET api/contact_activity/{Contact activity report ID}" When contact activity is created, its always created in status "Pending" (1), in order to know when the contact activity is ready, use this method and verify that the status is "Completed" (2).

  3. Get the instance results - When status is Complete, get results using "GET api/contact_activity/{Contact activity report ID}/result" This will return an array of the contacts you searched for.

GET /api/contact_activity/<Contact Activity search ID>

Description 

This method fetches a contact activity search (without results). This method can be used for checking the contact activity status.

...

KeyDescription
statusContact activity status, 1 = Pending, 2 = Completed
status_descContact activity report status description (Pending / Completed)

GET /api/contact_activity/<Contact Activity search ID>/result

Description 

This method fetches the contact activity results. This is the same report you see in the UI under Analytics -> Contact Activity Report, when you click on the "View Report" icon. This API command provides the same results as the export below, only in this case, it returns the entire result as a JSON response instead of CSV file.

...

Code Block
{
"metadata": {
  "error": false,
  "fields": {},
  "total": 3
},
"payload": [
  {
    "email": "email1@gmail.com",
    "last_name": "some-name",
     "opens": 4,
     "clicks": 2,
     "unsubscribe":0,
     "complains":0
  },
 {
    "email": "email2@gmail.com",
    "last_name": "some-name2",
     "opens": 3,
     "clicks": 1,
     "unsubscribe":0,
     "complains":1
  },
  {
    "email": "email3@gmail.com",
    "last_name": "some-name3",
     "opens": 1,
     "clicks": 0,
     "unsubscribe":1,
     "complains":1
  }
 ]
}

GET /api/contact_activity/<Contact Activity search ID>/export

Description 

This method exports an contact activity.

GET /api/contact_activity/<Contact Activity search ID>/export_detailed

Description 

This method exports the combined detailed contact activity report.

GET /api/contact_activity

Description 

This method fetches a collection of contact activity (without the results).

...

Optional int

limit

Optional int

POST /api/contact_activity

Description 

This method creates a new contact activity report.

...

Code Block
{
 "title": "Active gmail contacts",
 "selected_fields": [ "email", "ocx_status", "opens", "clicks" ],
 "filters": {
   "criteria": [
      {
        "type": "email",
        "field_name": "email",
        "operator": "_LIKE",
        "operand": [
          "gmail.com"
        ],
        "case_sensitive": 0,
        "condition": "and"
      }
   ],
   "user_type":"active"
 }
}

Request Example - Getting Contact Activity for a Segment for 1 month

...

Response (Major fields)

KeyDescription
idNewly created contact activity report ID
statusContact activity report status, will always be 1 (Pending) in this response

DELETE /api/contact_activity

...

/<Contact Activity report ID>

Description 

This method deletes a aggregate activity report.

Additional Examples

Request Example - Getting Contact Activity for a Segment for 1 month

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

Code Block
{
   "title":"Belongs to Segment Id: 1234567890",	// Use Segment ID for which you want to generate report
   "include_behavior":true,
   "filters":{
      "criteria":[
         {
            "field_name":"segment",
            "type":"segment",
            "operator":"=",
            "operand":[
               "1234567890" 	// Use Segment ID for which you want to generate report
            ],
            "case_sensitive":0,
            "condition":"and"
         }
      ],
      "user_type":"all",
      "from_date":1593118800, 	// Use Date/Timestamp i.e. 1 month prior to current date. Date has to be in MM/DD/YYYY format included as "MM/DD/YYYY".
      "to_date":1595883599 		// Use today's Date/timestamp 
   },
   "combined_as_and":true,
   "selected_fields":[
      "email",
      "ocx_created_date",
      "ocx_status",
      "sent",
      "opens",
      "clicks",
      "ocx_unsubscribe_date",
      "ocx_resubscribe_date",
      "ocx_bounce_date",
      "ocx_complaint_date",
      "last_sent_date",
      "last_open_date"
   ]
}

Request Example - Getting Contact Activity for a Campaign for 2 weeks

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

Code Block
{
   "title":"Belongs to Segment Id: 1234567890",	// Use Campaign ID for which you want to generate report
   "include_behavior":true,
   "filters":{
      "criteria":[
         {
            "field_name":"sent",
            "type":"behavioral",
            "operator":"=",
            "operand":{
				"mailing_ids":[
               		"1234567890" 	// Use Campaign ID for which you want to generate report
            ],
			}
            "case_sensitive":0,
            "condition":"and"
         }
      ],
      "user_type":"all",
      "from_date":1593118800, 	// Use Date/Timestamp i.e. 2 weeks prior to current date. Date has to be in MM/DD/YYYY format included as "MM/DD/YYYY".
      "to_date":1595883599 		// Use Today's Date/timestamp 
   },
   "combined_as_and":true,
   "selected_fields":[
      "email",
      "ocx_created_date",
      "ocx_status",
      "sent",
      "opens",
      "clicks",
      "ocx_unsubscribe_date",
      "ocx_resubscribe_date",
      "ocx_bounce_date",
      "ocx_complaint_date",
      "last_sent_date",
      "last_open_date"
   ]
}

Response (Major fields)

...

DELETE /api/contact_activity/<Contact Activity report ID>

Description 

...