REST API v3: GET template directories (Marketing Suite)
You can use the REST API to retrieve information of all template directories with an HTTP GET call to the following URL:
https://api.copernica.com/v3/ms/directories?access_token=xxxx
Returned fields
The method returns a JSON object containing the following information:
- id: The ID of the template directory.
- parentID: The ID of the parent template directory.
- name: The name of the directory (if any).
JSON example
The JSON will look something like this:
{
"id": "1",
"parentID": "",
"name": "folder1"
},
{
"id": "2",
"parentID": "",
"name": "folder2"
},
{
"id": "3",
"parentID": "2",
"name": "folder3"
}
PHP example
The script below demonstrates how to use this API method.
// dependencies
require_once('copernica_rest_api.php');
// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 3);
// execute the call
print_r($api->get("ms/directories"));
This example requires the REST API class