REST API v4: POST emailing (drag and drop template)

You can post a drag and drop mailing with our REST API if you have already completed a template and prepared your database. To send a new mailing you send an HTTP POST request to the following URL:

https://api.copernica.com/v4/draganddrop/emailing

Available parameters

There are three parameteres available, all of them required.

  • target: The ID of the emailing target.
  • targettype: The type of the target (database, collection, view, miniview, profile or subprofile)
  • template: The ID of the template to use.

Make sure your template is complete before posting the call. The mailing can not be sent without a valid subject and from address. You should also make sure your sender domain is configured correctly before attempting to send a mailing.

JSON example

The following JSON demonstrates how to use the API method:

{
    "target": 1234,
    "targettype":"view",
    "template":12
}

PHP example

The following script demonstrates how to call the API method. Don't forget to substitute the parameters for your own target and template.

<?php

// dependencies
require_once('CopernicaRestAPI.php');

// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);

// parameters to pass to the call
$parameters = array(
    'target'                  => 1234,
    'targettype'              => "view",
    'template'                => 12
);

// execute the call
print_r($api->post("draganddrop/emailing", $parameters));

// returns the id of created request if succesful

This example requires our REST API class.

More information