REST API v4: POST collection intentions

The collection intentions indicate what type of communication is allowed with this collection. The intentions for email, sms and pdf can all be enabled separately, to prevent accidental mailings.

The HTTP POST call to edit the intentions of a collection can be found at the following address:

https://api.copernica.com/v4/collection/$id/intentions

The $id in the URL should be replaced by the unique identifier of the collection.

Available parameters

The following parameters are available for the method. They are all optional and the intentions corresponding to the variables that are not used will not be changed.

  • email: Boolean that indicates whether the intention for email should be enabled.
  • sms: Boolean that indicates whether the intention for sms should be enabled.
  • pdf: Boolean that indicates whether the intention for pdf should be enabled.

Intentions can not be enabled if the corresponding field in the database does not exist.

JSON example

The following JSON demonstrates how to use the API method:

{
  "email": true,
  "sms": false,
  "pdf": true
}

PHP example

The following example demonstrates how to use this method.

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

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

// parameters for the method
$data = array(
    'email' =>  true,
    'sms'   =>  true,
    'pdf'   =>  true
);

// voer het verzoek uit
$api->post("collection/{$collectionID}/intentions", $data);

This method requires the CopernicaRestAPI class.

More information