These are all the 1.0 APIs that have been deprecated since 23-Jan-2019. Please use the latest version of API 2.0.

/template/create

Create new template

title :

required

Text

Title of the template

htmlcode :

required

Text

HTML code for the template.
Use "${Variable_Name}" for variable.
Use "<captcha></captcha>" for captcha.

You can create new template using this API
curl -H "MicroworkersApiKey:YOUR_API_KEY" -X POST "https://ttv.microworkers.com/api/template/create/format/json" -F "title=new template" -F "htmlcode=&lt;table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"table\"><tbody><tr><td colspan=\"2\"><img alt=\"\" src=\"${Image}\" /></td></tr><tr><td>Tag</td><td><input name=\"tag\" type=\"text\" /></td></tr><tr><td>Comment</td><td><textarea name=\"Comment\"></textarea></td></tr></tbody></table><p>&nbsp;</p>" 
from pprint import pprint
from MW_API import MW_API
mw_api = MW_API('YOUR_API_KEY')
res = mw_api.do_request('POST','/template/create/format/json', {"title" : "new template", "htmlcode" : "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"table\"><tbody><tr><td colspan=\"2\"><img alt=\"\" src=\"${Image}\" /></td></tr><tr><td>Tag</td><td><input name=\"tag\" type=\"text\" /></td></tr><tr><td>Comment</td><td><textarea name=\"Comment\"></textarea></td></tr></tbody></table><p>&nbsp;</p>"}, {})
pprint(res)
use MW_API;
use Data::Dumper qw(Dumper);
my $mw_api = MW_API->new('api_key' => 'YOUR_API_KEY');
my $res = $mw_api->do_request('POST', '/template/create/format/json', {
  "title" => "new template", "htmlcode" => "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"table\"><tbody><tr><td colspan=\"2\"><img alt=\"\" src=\"${Image}\" /></td></tr><tr><td>Tag</td><td><input name=\"tag\" type=\"text\" /></td></tr><tr><td>Comment</td><td><textarea name=\"Comment\"></textarea></td></tr></tbody></table><p>&nbsp;</p>"
});
print Dumper($res);
<?php

include "includes/RESTClient.php";
define("cAPI_KEY", "YOUR_API_KEY");
define("cAPI_URL", "https://ttv.microworkers.com/api");
$client = new RESTClient();
$client->setApiKey(cAPI_KEY);
$client->setUrl(cAPI_URL . "/template/create/format/json");
$client->setMethod("POST");
$client->setData(array("title" => "new template", "htmlcode" => "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"table\"><tbody><tr><td colspan=\"2\"><img alt=\"\" src=\"\${Image}\" /></td></tr><tr><td>Tag</td><td><input name=\"tag\" type=\"text\" /></td></tr><tr><td>Comment</td><td><textarea name=\"Comment\"></textarea></td></tr></tbody></table><p>&nbsp;</p>"));
$client->execute();
$response = $client->getLastResponse();
$client->resetClient();
echo $response;
?>
using System;
using MWAPI;
using System.Collections.Specialized;

public class Test{
  public static void Main (string[] args){
    MW_API MW_API_Client = new MW_API ("YOUR_API_KEY");
NameValueCollection postData = new NameValueCollection();
    postData.Add("title", "new template");
     postData.Add("htmlcode", "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"table\"><tbody><tr><td colspan=\"2\"><img alt=\"\" src=\"${Image}\" /></td></tr><tr><td>Tag</td><td><input name=\"tag\" type=\"text\" /></td></tr><tr><td>Comment</td><td><textarea name=\"Comment\"></textarea></td></tr></tbody></table><p>&nbsp;</p>");
    
    string body = MW_API_Client.postRequest("/template/create/format/json", postData);
    Console.WriteLine (body);
  }
}

Definition


Result Format

{
  "status": "SUCCESS",
  "response": {
    "template_id": "T55607e803f2fa"
  }
}
{
  "status": "ERROR",
  "message": "TTVAPI-E0004:TTVTemplate-E0010:The 'Template Title' field is required."
}
{
  "status": "ERROR",
  "message": "TTVAPI-E0004:TTVTemplate-E0002:The 'name' attribute is required for INPUT type tag."
}
{
  "status": "ERROR",
  "message": "TTVAPI-E0004:TTVTemplate-E0004:No question found. Template must have at least one input question."
}