REST API: GET documents (Publisher template)

You can use the REST API to retrieve a all emailing documents belonging to a template with an HTTP GET call to the following URL:$id/documents

Where $id should be replaced with the ID of the emailing template you want to retrieve the emailing documents for.

Returned fields

The method returns a JSON object where the *data field contains an array with emailing documents. Each document contains the following information:

  • id: The ID of the document.
  • template: The ID of the corresponding template.
  • name: The name of the document.
  • from_address: The from address for the document.
  • subject: The subject of the document.
  • archived: The archive status of the document. (1 for archived, null for not archived)
  • source: The source of the document.

JSON example

The JSON for the document might look something like this:

   "from_address":"\"test\" <>",

PHP example

The script below demonstrates how to use this API method. Don't forget to replace the ID in the URL before executing the call.

// dependencies

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

// execute the call

This example requires the REST API class

More information