Trouble creating template using API

I am authorizing using the api key with the follow code:

$auth = array('api_key' => 'api key');
$wrap = new CS_REST_Templates(NULL, $auth);
$result = $wrap->create('client id', array(
    'Name' => 'Template test',
    'HtmlPageURL' => 'http://localhost/templates/cmtest.html',
    'ZipFileURL' => null,
));

I am getting this error
object(stdClass)#244 (2) {
  ["Code"]=>
  int(4005)
  ["Message"]=>
  string(21) "Invalid HTML Page URL"
}


I have the html template in the location specified but still keep getting the invalid HTML page url.

Can someone please help

Phil Phil, 3 years ago

Hi jvyda,

The HtmlPageURL needs to be a URL which is accessible to our servers, so that they can download the template source. That means it needs to be a publicly accessible URL, which anything at "localhost" is not.

You'll need to host the template code somewhere public and then use that URL instead.

jvyda, 3 years ago

Thanks phil,
Realized the issue and got it working. thanks for the reply though.
cheers

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098