'your access token', 'refresh_token' => 'your refresh token'); $wrap = new CS_REST_Campaigns(NULL, $auth); $template_content = array( 'Singlelines' => array( array( 'Content' => 'This is a heading', 'Href' => 'http://example.com/' ) ), 'Multilines' => array( array( 'Content' => '

This is example

multiline content...

' ) ), 'Images' => array( array( 'Content' => 'http://example.com/image.png', 'Alt' => 'This is alt text for an image', 'Href' => 'http://example.com/' ) ), 'Repeaters' => array( array( 'Items' => array( array( 'Layout' => 'My layout', 'Singlelines' => array( array( 'Content' => 'This is a repeater heading', 'Href' => 'http://example.com/' ) ), 'Multilines' => array( array( 'Content' => '

This is example

multiline content...

' ) ), 'Images' => array( array( 'Content' => 'http://example.com/image.png', 'Alt' => 'This is alt text for a repeater image', 'Href' => 'http://example.com/' ) ) ) ) ) ) ); # $template_content as defined above would be used to fill the content of # a template with markup similar to the following: # # # My Template # #

Enter heading...

#
Enter description...
# # # #
#

#
# #
#
#
#

Unsubscribe

# # $result = $wrap->create_from_template('Campaigns Client ID', array( 'Subject' => 'Campaign Subject', 'Name' => 'Campaign Name', 'FromName' => 'Campaign From Name', 'FromEmail' => 'Campaign From Email Address', 'ReplyTo' => 'Campaign Reply To Email Address', 'ListIDs' => array('First List', 'Second List'), 'SegmentIDs' => array('First Segment', 'Second Segment'), 'TemplateID' => 'Template ID', 'TemplateContent' => $template_content )); echo "Result of POST /api/v3.1/campaigns/{clientID}/fromtemplate\n
"; if($result->was_successful()) { echo "Created with ID\n
".$result->response; } else { echo 'Failed with code '.$result->http_status_code."\n
";
    var_dump($result->response);
    echo '
'; }