The following examples demonstrate the usage of the Template API.
The API is accessed via URL with generated token id, similar to:
​https://api.cloudtruth.com/t/d12f53fd-c1a6-444e-bece-164aa1b817bc​
Template URLs can be obtained from the "Copy URL [for this environment]" link on the Template edit screen.
This sample uses the built-in Python functionality to call the CloudTruth Template URL and parse the results in JSON Format
import requestsreq = requests.get('https://api.cloudtruth.com/t/' + TEMPLATE_ID)req.json()
This sample uses the built-in JavaScript functionality to call the CloudTruth Template URL and parse the results in JSON format.
var req = new XMLHttpRequest();req.open('GET', 'https://api.cloudtruth.com/t/' + TEMPLATE_ID, false);var obj = JSON.parse(req.responseText);
This sample uses standard libraries to call the CloudTruth Template URL and parse the results in JSON Format
String url = "https://api.cloudtruth.com/t/" + TEMPLATE_ID;Scanner scanner = new Scanner(new URL(url).openStream(),StandardCharsets.UTF_8.toString());scanner.useDelimiter("\\A");JSONObject obj = readnew JSONObject(scanner.hasNext() ? scanner.next() : "");