REST API v4: GET HTML personalized document (subprofile)
You can retrieve the perzonalized HTML document for a subprofile by sending an HTTP GET call to the following URL:
https://api.copernica.com/v4/subprofile/$subprofileID/html/document/$documentID
Where the $subprofileID
should be replaced with the ID of the subprofile and the $documentID
with the ID of the document.
Returned fields
The method returns a JSON object with the following information:
- id: ID of the document
- template: ID of the template
- name: name of the document
- description: description of the document
- from_address: from address of the document
- subject: subject of the document
- archived: the archive status of the document (true for archived, false for not archived)
- source: the personalized source of the document based on the given subprofile ID
JSON example
The JSON look something like this:
{
"id": "285",
"template": "114",
"name": "Test",
"description": "",
"from_address": "\"Jeroen\" <info@copernica.com>",
"subject": "Test",
"archived": false,
"source": "<html>\n\t<body>\nThis is a test message<br />\n</body>\n</html>"
}
PHP example
This script demonstrates how to use this API method:
// dependencies
require_once('CopernicaRestAPI.php');
// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);
// execute the call
print_r($api->get("subprofile/{$subprofileID}/html/document/{$documentID}"));
This example requires the REST API class.