דלג לתוכן הראשי

delete_prompt

GET / POST   /api/?service=delete_prompt

Removes an uploaded prompt by name. Calls already queued that reference the prompt may fail to play it, so delete prompts only when no campaign uses them.

Parameters

ParameterDescription
filename (required)The prompt name returned by upload_prompt, without extension. Must not contain /.

Request examples

cURL

curl "https://dialer2.maskyoo.com/{system_name}/api/?service=delete_prompt&filename=welcome_msg" \
-H "Authorization: Bearer 3f9c2a1e7b4d…"

PHP

<?php
$url = "https://dialer2.maskyoo.com/{system_name}/api/?" . http_build_query([
"service" => "delete_prompt",
"filename" => "welcome_msg",
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["Authorization: Bearer 3f9c2a1e7b4d…"],
CURLOPT_RETURNTRANSFER => true,
]);
$body = curl_exec($ch);
curl_close($ch);

$xml = @simplexml_load_string($body);
if ($xml === false) {
throw new RuntimeException("delete_prompt rejected: " . trim($body)); // e.g. "error 2956:1"
}
if (strcasecmp((string)$xml->status, "OK") !== 0) {
throw new RuntimeException("delete_prompt failed: " . $xml->description);
}
echo "Prompt deleted\n";

C#

using System.Net.Http;
using System.Net.Http.Headers;
using System.Xml.Linq;

var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "3f9c2a1e7b4d…");

var url = "https://dialer2.maskyoo.com/{system_name}/api/?service=delete_prompt&filename="
+ Uri.EscapeDataString("welcome_msg");
var body = await http.GetStringAsync(url);

if (!body.TrimStart().StartsWith("<"))
throw new Exception($"delete_prompt rejected: {body.Trim()}"); // e.g. "error 2956:1"

var root = XDocument.Parse(body).Root!;
if (!string.Equals(root.Element("status")?.Value, "OK", StringComparison.OrdinalIgnoreCase))
throw new Exception($"delete_prompt failed: {root.Element("description")?.Value}");

Console.WriteLine("Prompt deleted");

Responses

Response — HTTP 200, success (XML)

<?xml version="1.0"?>
<root>
<service>delete_prompt</service>
<status>OK</status>
<description>The prompt file was deleted</description>
</root>

Response — HTTP 200, error (XML)

<?xml version="1.0"?>
<root>
<service>delete_prompt</service>
<status>Error</status>
<description>Error: there is no prompt with that name in the system</description>
</root>

Response — HTTP 200, validation error (plain text)

error 2956:1

All responses of this service

HTTPFormatBodyMeaning
200XML<status>OK</status> <description>The prompt file was deleted</description>Prompt removed.
200XML<description>Error: there is no prompt with that name in the system</description>No prompt with that name.
200texterror 2956:1filename contains a slash.

ראו גם