Przejdź do treści

Announcement Update

Aktualizacja zapowiedzi

PUT /announcement/{announcement_id}

URL Parameters

Nazwa Rodzaj Opcjonalne Opis
announcement_id <STRING> 5ecf67c2f03d6453ad1ae38b Identyfikator systemowy 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

{
    {
        "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
404 Nie znaleziono zasobu

application/json

curl -X PUT \
$CONPEEK_URL/announcement/5ecf67c2f03d6453ad1ae38b \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: application/json' \
-d '{"data": {
        "name": "Zaktualizowana nazwa",
        "description": "Nowy opis zapowiedzi",
        "category": "Nazwa kategorii",
        "default_language": "pl-PL",
        "voice_definition_id": "voice_definition_id_here",
        "text": "Zaktualizowany tekst",
        "ssml": null
}}'
import requests
import json
import os
from urllib import parse

url = parse.urljoin(os.environ["CONPEEK_URL"], "/announcement/%(announcement_id)s" % {
    "announcement_id": "5ecf67c2f03d6453ad1ae38b"
})

payload = {
    "data": {
        "name": "Zaktualizowana nazwa",
        "description": "Nowy opis zapowiedzi",
        "category": "Nazwa kategorii",
        "default_language": "pl-PL",
        "voice_definition_id": "voice_definition_id_here",
        "text": "Zaktualizowany tekst",
        "ssml": None
    }
}

headers = {
    'Content-Type': "application/json",
    'Authorization': os.environ["CONPEEK_KEY"]
}

response = requests.request("PUT", url, data=json.dumps(payload), headers=headers)
print(response.text)
<?php
$curl = curl_init();

$payload = array(
    "data" => array(
        "name" => "Zaktualizowana nazwa",
        "description" => "Nowy opis zapowiedzi",
        "category" => "Nazwa kategorii",
        "default_language" => "pl-PL",
        "voice_definition_id" => "voice_definition_id_here",
        "text" => "Zaktualizowany tekst",
        "ssml" => null
    )
);

$announcement_id = "5ecf67c2f03d6453ad1ae38b";

curl_setopt_array($curl, array(
    CURLOPT_URL => getenv("CONPEEK_URL")."/announcement/$announcement_id",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_PUTFIELDS => 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 PUT \
$CONPEEK_URL/announcement/5ecf67c2f03d6453ad1ae38b \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: multipart/form-data' \
-F file=@/home/conpeek/announcement.mp3