template_id
:
required |
Text
Template Id must be starts with "T". |
title
:
required |
Text
New title of the template. |
htmlcode
:
required |
Text
New html code of the template |
curl -H "MicroworkersApiKey:YOUR_API_KEY" -X PUT "https://ttv.microworkers.com/api/template/update/format/json" -d "template_id=T54f9518a418e2&title=updated title&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> </p>"
from pprint import pprint
from MW_API import MW_API
mw_api = MW_API('YOUR_API_KEY')
res = mw_api.do_request('PUT','/template/update/format/json', {"template_id" : "T54f9518a418e2", "title" : "updated title", "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> </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('PUT', '/template/update/format/json', {
"template_id" => "T54f9518a418e2", "title" => "updated title", "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> </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/update/format/json");
$client->setMethod("PUT");
$client->setData(array("template_id" => "T54f9518a418e2", "title" => "updated title", "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> </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("template_id", "T54f9518a418e2");
postData.Add("title", "updated title");
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> </p>");
string body = MW_API_Client.putRequest("/template/update/format/json", postData);
Console.WriteLine (body);
}
}
{ "status": "SUCCESS", "response": "Template successfully updated." }
{ "status": "ERROR", "message": "TTVAPI-E0004:TTVTemplate-E0010:The 'Html Code' field is required." }
{ "status": "ERROR", "message": "TTVAPI-E0004:TTVTemplate-E0000:Template id (1234) not found." }
{ "status": "ERROR", "message": "TTVAPI-E0004:TTVTemplate-E0004:No question found. Template must have at least one input question." }