Announcement Create
Stworzenie nowej zapowiedzi
POST /announcement
Body
application/json
{
"data": {
"name": "Zapowiedź TTS",
"description": "Zapowiedź generowana na podstawie tekstu",
"category": "Nazwa kategorii",
"default_language": "en-EN",
"voice_definition_id": "6746ef126044fb00010b7e43",
"text": "Dzień dobry",
"ssml": null
}
}
multipart/form-data
{
{
"name": "Zapowiedź TTS",
"description": "Zapowiedź generowana na podstawie tekstu",
"category": "Nazwa kategorii",
"default_language": "en-EN",
"file": <file>,
}
}
Response Body
{
"data": <Announcement>
}
Nazwa | Rodzaj | Opcjonalne | Opis |
---|---|---|---|
data | <Announcement> |
NIE | Announcement |
Response Code
Status | Opis |
---|---|
200 | Żądanie przyjęte do realizacji |
400 | Niepoprawne dane |
503 | Serwis niedostępny |
application/json
curl -X POST \
$CONPEEK_URL/announcement \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: application/json' \
-d '{"data": {
"name": "Witaj",
"description": "Zapowiedź na dzień dobry",
"category": "Nazwa kategorii",
"default_language": "pl-PL",
"voice_definition_id": "voice_definition_id_here",
"text": "Dzień dobry",
"ssml": null
}}'
import requests
import json
import os
from urllib import parse
url = parse.urljoin(os.environ["CONPEEK_URL"], "/announcement")
payload = {
"data": {
"name": "Witaj",
"description": "Zapowiedź na dzień dobry",
"category": "Nazwa kategorii",
"default_language": "pl-PL",
"voice_definition_id": "voice_definition_id_here",
"text": "Dzień dobry",
"ssml": None,
}
}
headers = {
'Content-Type': "application/json",
'Authorization': os.environ["CONPEEK_KEY"]
}
response = requests.request("POST", url, data=json.dumps(payload), headers=headers)
print(response.text)
<?php
$curl = curl_init();
$payload = array(
"data" => array(
"name" => "Witaj",
"description" => "Zapowiedź na dzień dobry",
"category" => "Nazwa kategorii",
"default_language" => "pl-PL",
"voice_definition_id" => "voice_definition_id_here",
"text" => "Dzień dobry",
"ssml" => null
)
);
curl_setopt_array($curl, array(
CURLOPT_URL => getenv("CONPEEK_URL")."/announcement",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
"Authorization: ".getenv("CONPEEK_KEY"),
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
multipart/form-data`
curl -X POST \
$CONPEEK_URL/announcement \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: multipart/form-data' \
-F name="test_file" \
-F description="opis" \
-F category="category" \
-F default_language="pl-PL" \
-F file=@/home/conpeek/announcement.mp3