This article explains how to embed the TemplateCloud editor on your website using some simple HTML & Javascript call.
You will also need to create an editor session to tell the editor which template or instance should be modified using an API call.
Note: this is a new simplified approach to opening the editor that means integrators no longer need to use the Create Instance API call.
Once you've got an sdsid, you can use this in your editor
To load the editor add this HTML
<html>
<head>
<title>Editor</title>
</head>
<body>
<script src="https://dev.editor.w3p.com/js/editor.js"></script>
<script type="text/javascript">
TemplateEditor = new TemplateEditor({
options: {
src: 'https://dev.editor.w3p.com',
height: '400px',
width: '600px'
},
params: {
sdsession: '<your sdsid>',
continue_url: '<your continue url>',
exit_url: '<your exit url>'
}
});
TemplateEditor.init();
</script>
</body>
</html>
Options | Description | Required? |
---|---|---|
src |
The url of the editor. |
Yes |
width | Width of the editor Eg 800px |
No |
height | Height of the editor Eg 400px |
No |
fullscreen | either "true" or "false" If "true" we'll load the editor fullscreen |
No |
Params | Description | Required? |
---|---|---|
sdsession | Get this from the POST /sessions/create API call See below for more details |
Yes |
continue_url | The url to send people to after they press Next step in the editor | Yes |
exit_url | The url to send people to after they press Quit & cancel in the editor | Yes |
locale |
The language to open the editor in. tc_US for US. |
No |
/sessions/create
Creates an editor session to open the editor.
Works with both GET and POST API calls
POST only returns in XML, but requires no user_key
Parameter | Description |
---|---|
format | json or xml |
Required option | |
template_id |
One template ID. Use this to get a SDSession to use when you open the editor. |
instance_id |
One instance ID. Use this to get a SDSession to use when you open the editor. |
http://api.templatecloud.com/sandbox/sessions/create/?template_id=31081
<?xml version="1.0" encoding="UTF-8"?> <response status="ok"> <message>SDSession created.</message> <sdsid>9cfcd1e8f11a5659752074ff33e17b9af869a34f</sdsid> <instance_id>2196719</instance_id> <template_id>31081</template_id> </response>
http://api.templatecloud.com/sandbox/sessions/create?instance_id=2196517
<?xml version="1.0" encoding="UTF-8"?> <response status="ok"> <message>SDSession created.</message> <sdsid>4cbde1cb9d1a81e397937a0576d654f03f824103</sdsid> <instance_id>2196517</instance_id> <template_id>31081</template_id> </response>
Jump to contents page of
|