DELETE /v1/templates/delete
DELETE https://api.reporting.cloud/v1/templates/delete
Description
Deletes a template from the template storage, which frees its place in the template storage quota. The name in templateName is matched regardless of case; a name that isn't stored answers 400. See Managing Templates.
Examples
Request:
curl username:password \
DELETE "https://api.reporting.cloud/v1/templates/delete?templateName=test.tx"
Request:
using System;
using TXTextControl.ReportingCloud;
class RCSamples
{
public static void DeleteTemplate(string templateName)
{
ReportingCloud rc = new ReportingCloud(
"username",
"password",
new Uri("https://api.reporting.cloud"));
try
{
rc.DeleteTemplate(templateName);
Console.WriteLine(templateName + " has been deleted.");
}
catch (Exception e)
{
Console.WriteLine("An error occurred: " + e.Message);
}
}
}
Results:
test.tx has been deleted.
Request:
import com.textcontrol.reportingcloud.ReportingCloud;
import java.io.IOException;
public class ReportingCloudSample {
public static void main(String[] args) throws IOException {
ReportingCloud r = new ReportingCloud("username", "password");
r.deleteTemplate("test.tx");
}
}
Request:
#!/usr/bin/env ruby
require "txtextcontrol/reportingcloud"
reporting_cloud = TXTextControl::ReportingCloud::ReportingCloud.new("username", "password")
reporting_cloud.delete_template("test.tx")
Request:
require_once __DIR__ . '/vendor/autoload.php';
use TextControl\ReportingCloud\ReportingCloud;
$reportingCloud = new ReportingCloud([
'api_key' => (string) getenv('REPORTINGCLOUD_API_KEY'),
]);
var_dump($reportingCloud->deleteTemplate('test.tx'));
Results:
bool(true)
Authorization
This endpoint requires a "ReportingCloud-APIKey" or a "Basic" user authorization to access the user account, data and templates. Only one of these two methods is required.
API Keys describes how to create an API key, and Authentication explains both header forms.
ReportingCloud-APIKey
| Header field | Description |
|---|---|
| Authorization | Required. A valid ReportingCloud account is required. The Authorization field is constructed as follows: An API key needs to be generated in the portal or with PUT /v1/account/apikey. The authorization method and a space, "ReportingCloud-APIKey ", is then put before the actual API key string. For example: Authorization: ReportingCloud-APIKey oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI |
Basic
| Header field | Description |
|---|---|
| Authorization | Required. A valid ReportingCloud account is required. The Authorization field is constructed as follows: The user name and password are combined into a string separated by a colon, for example username:password. The resulting string is encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line. The authorization method and a space, "Basic ", is then put before the encoded string. For example: Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l |
Request Parameters
| Name | Type | Value | Optional |
|---|---|---|---|
| templateName | String | The filename of the template to be deleted from the template storage. The filename is not case-sensitive. | no |
Success Response
| Status | Description |
|---|---|
| 204 | On success, the HTTP status code in the response header is 204 (No Content). |
Error Response
| Status | Description |
|---|---|
| 400 | A 400 (Bad Request) is returned, if the template doesn't exist in the template storage or templateName is empty. |
| 403 | A 403 (Forbidden) is returned, if the user is not authorized. |
| 404 | A 404 (Not Found) is returned, if a required query parameter is missing. |
| 405 | A 405 (Method Not Allowed) is returned, if the request uses another HTTP method than DELETE. The Allow header of the response names DELETE. |
| 500 | A 500 (Internal Server Error) is returned, if the request has no Authorization header, an empty one or one that is not the authorization method, a space and the credentials. |