Odeslat hromadný hlas s Java
Pošlete hlasovou zprávu skupině pevných linek nebo telefonů s Java
Java : DOKUMENTACE API
- Vytvořit skupinu pomocí Java
- Seznam skupinových polí s Java
- Přidejte pole do skupiny s Java
- Odstranění pole ze skupiny s Java
- Odstranění kontaktu ze skupiny
- Přiřazení země do skupiny s Java
- Seznam skupinových kontaktů s Java
- Přidejte kontakt do skupiny s Java
- Upravit kontakt skupiny pomocí Java
- Smazat kontakt skupiny s Java
- Získejte seznam aktivních chatovacích kanálů s jazykem Java
- Odeslat zprávu prostřednictvím chatu s jazykem Java
- Odeslat soubor prostřednictvím chatu s jazykem Java
- Získejte seznam konverzací v chatu s jazykem Java
- Získejte seznam zpráv z chatu s jazykem Java
- Získejte seznam nepřečtených zpráv z chatu s jazykem Java
Odeslat hromadný hlas s Java
String afilnet_class="voice";
String afilnet_method="sendvoicetogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="34900000000";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_message="sms+test";
String afilnet_language="en";
String afilnet_voice="Joanna";
String afilnet_scheduledatetime="";
String afilnet_output="";
// Create an URL request
String sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&from="+afilnet_from+"&countrycode="+afilnet_countrycode+"&idgroup="+afilnet_idgroup+"&message="+afilnet_message+"&language="+afilnet_language+"&voice="+afilnet_voice+"&scheduledatetime="+afilnet_scheduledatetime+"&output="+afilnet_output;
URL url = new URL(sUrl);
StringBuilder builder = new StringBuilder();
BufferedReader theJSONline = new BufferedReader(new InputStreamReader(url.openStream()));
builder.append(theJSONline.readLine());
String content = builder.toString();
String afilnet_class="voice";
String afilnet_method="sendvoicetogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="34900000000";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_message="sms+test";
String afilnet_language="en";
String afilnet_voice="Joanna";
String afilnet_scheduledatetime="";
String afilnet_output="";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&from="+afilnet_from+"&countrycode="+afilnet_countrycode+"&idgroup="+afilnet_idgroup+"&message="+afilnet_message+"&language="+afilnet_language+"&voice="+afilnet_voice+"&scheduledatetime="+afilnet_scheduledatetime+"&output="+afilnet_output;
// We generate the URL
URL myurl = new URL("https://www.afilnet.com/api/http/");
// We create the connection
HttpURLConnection con = (HttpURLConnection) myurl.openConnection();
con.setDoOutput(true);
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
con.setRequestProperty("Content-Length", String.valueOf(post.length()));
con.setRequestMethod("POST");
// We build the
OutputStream os = con.getOutputStream();
os.write(post.getBytes());
os.close();
StringBuilder sb = new StringBuilder();
int HttpResult = con.getResponseCode();
if(HttpResult == HttpURLConnection.HTTP_OK)
{
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(),"utf-8"));
String line = null;
while ((line = br.readLine()) != null) {
sb.append(line + "\n");
}
br.close();
System.out.println(""+sb.toString());
} else {
System.out.println(con.getResponseCode());
System.out.println(con.getResponseMessage());
}
String afilnet_class="voice";
String afilnet_method="sendvoicetogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="34900000000";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_message="sms+test";
String afilnet_language="en";
String afilnet_voice="Joanna";
String afilnet_scheduledatetime="";
String afilnet_output="";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&from="+afilnet_from+"&countrycode="+afilnet_countrycode+"&idgroup="+afilnet_idgroup+"&message="+afilnet_message+"&language="+afilnet_language+"&voice="+afilnet_voice+"&scheduledatetime="+afilnet_scheduledatetime+"&output="+afilnet_output;
// We generate the URL
URL myurl = new URL("https://www.afilnet.com/api/basic/");
// We create the connection
HttpURLConnection con = (HttpURLConnection) myurl.openConnection();
String encoded = Base64.getEncoder().encodeToString((afilnet_user+":"+afilnet_password).getBytes(StandardCharsets.UTF_8));
con.setRequestProperty("Authorization", "Basic "+encoded);
con.setDoOutput(true);
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
con.setRequestProperty("Content-Length", String.valueOf(post.length()));
con.setRequestMethod("POST");
// We build the
OutputStream os = con.getOutputStream();
os.write(post.getBytes());
os.close();
StringBuilder sb = new StringBuilder();
int HttpResult = con.getResponseCode();
if(HttpResult == HttpURLConnection.HTTP_OK)
{
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(),"utf-8"));
String line = null;
while ((line = br.readLine()) != null) {
sb.append(line + "\n");
}
br.close();
System.out.println(""+sb.toString());
} else {
System.out.println(con.getResponseCode());
System.out.println(con.getResponseMessage());
}
Parametr | Popis | Povinné / Nepovinné |
---|---|---|
class=voice | Požadovaná třída: Třída, na kterou je žádost podána | Povinný |
method=sendvoicetogroup | Požadovaná metoda třídy: Metoda třídy, které je žádost podána | Povinný |
user | Uživatel a e-mail vašeho účtu Afilnet | Povinný |
password | Heslo vašeho účtu Afilnet | Povinný |
from | Odesílatel hlasového hovoru, musí to být telefonní číslo, pokud je zahrnut nepřijatý odesílatel, bude hlasový hovor odeslán neznámému odesílateli | Povinný |
countrycode | Předpona země | Povinný |
idgroup | Identifikátor skupiny obsahující kontakty, na které bude odeslán hlasový hovor | Povinný |
message | Zpráva, kterou chcete přehrát hlasem v hlasovém hovoru | Povinný |
language | Jazyk, ve kterém bude hlasový hovor přehráván, zkontrolujte dostupné hodnoty v přiložené tabulce | Volitelný |
voice | Hlas, kterým se bude hlasový hovor přehrávat, najdete dostupné hodnoty v přiložené tabulce | Volitelný |
scheduledatetime | Datum a čas odeslání ve formátu rrrr-mm-dd hh:mm:ss | Volitelný |
output | Výstupní formát výsledku | Volitelný |
Při zadávání žádostí obdržíte následující pole:
- status
-
výsledek (pokud status = úspěch), zde obdržíte následující hodnoty:
- id
- count
- credits
-
destinations
- messageid
- destination
- chyba (pokud status = chyba), zde obdržíte kód chyby
Možné chybové kódy jsou uvedeny níže
Kód | Popis |
---|---|
MISSING_USER | Uživatel nebo e-mail nejsou zahrnuty |
MISSING_PASSWORD | Heslo není zahrnuto |
MISSING_CLASS | Třída není zahrnuta |
MISSING_METHOD | Metoda není zahrnuta |
MISSING_COMPULSORY_PARAM | Povinný parametr není zahrnut |
INCORRECT_USER_PASSWORD | Nesprávný uživatel nebo heslo |
INCORRECT_CLASS | Nesprávná třída |
INCORRECT_METHOD | Nesprávná metoda |
NOT_ACCESS_TO_GROUP | Do uvedené skupiny nemáte povolení |
NO_CREDITS | Váš zůstatek je nedostatečný |
Parametry:
- class : voice
- method : sendvoicetogroup
- user : user
- password : password
- from : 34900000000
- countrycode : 34
- idgroup : 1
- message : sms+test
- language : en
- voice : Joanna
- scheduledatetime :
- output :
Žádost:
https://www.afilnet.com/api/http/?class=voice&method=sendvoicetogroup&user=user&password=password&from=34900000000&countrycode=34&idgroup=1&message=sms+test&language=en&voice=Joanna&scheduledatetime=&output=
PŘÍLOHA: Seznam jazyků a hlasů pro dostupné hlasové hovory
V této příloze najdete všechny možné kombinace jazyků a hlasů, které můžete použít při odesílání hlasových zpráv
Jazyk (language) | Rod | název (voice) |
---|---|---|
ar | female | Hoda |
ar | male | Naayf |
ar | male | Tarik |
ar | female | Zeina |
ar | female | Aisha |
ar | male | Farooq |
ar | male | Hussein |
ar | female | Amal |
bg | male | Ivan |
bn | female | Sushmita |
bn | male | Sayan |
ca | female | Conchita |
ca | female | Herena |
ca | female | Montserrat |
cs | male | Jakub |
da | female | Naja |
da | female | Helle |
da | male | Mads |
de | male | Hans |
de | female | Hedda |
de | female | Marlene |
de | male | Stefan |
de | female | Angela |
de | female | Vicki |
de-at | male | Michael |
de-ch | male | Karsten |
el | male | Stefanos |
el | female | Afroditi |
el | female | Sophia |
en | female | Jessica |
en | male | Joey |
en | female | Joanna |
en | female | Jane |
en | female | Ivy |
en | male | Guy |
en | male | Benjamin |
en | female | Kimberly |
en | male | Matthew |
en | female | Kendra |
en | female | Salli |
en | female | Zira |
en | male | Justin |
en-au | male | Russell |
en-au | female | Catherine |
en-au | female | Hayley |
en-au | female | Nicole |
en-ca | female | Alice |
en-ca | female | Heather |
en-gb | female | Rosie |
en-gb | female | Hazel |
en-gb | male | George |
en-gb | male | Brian |
en-gb | female | Amy |
en-gb | female | Emma |
en-gb-wls | male | Geraint |
en-ie | male | Sean |
en-in | female | Heera |
en-in | male | Ravi |
en-in | female | Raveena |
en-in | female | Priya |
en-in | female | Aditi |
es | male | Miguel |
es | female | Penelope |
es | female | Lupe |
es | male | Pablo |
es | male | Enrique |
es | female | Laura |
es | female | Linda |
es-ar | male | Diego |
es-cl | female | Francisca |
es-es | female | Lola |
es-mx | male | Raul |
es-mx | female | Mia |
es-mx | female | Hilda |
fi | female | Heidi |
fi | female | Milla |
fi | female | Evelin |
fr | female | Juliette |
fr | female | Celine |
fr | male | Mathieu |
fr | female | Lea |
fr | female | Hortense |
fr | male | Picart |
fr-ca | female | Chantal |
fr-ca | female | Harmonie |
fr-ca | female | Caroline |
fr-ch | male | Guillaume |
gu | male | Dinesh |
gu | female | Leela |
he | male | Asaf |
hi | female | Aadita |
hi | female | Kalpana |
hi | male | Hemant |
hr | male | Matej |
hu | male | Szabolcs |
id | male | Andika |
id | male | Arif |
id | female | Indah |
id | male | Reza |
id | female | Nurul |
is | male | Karl |
is | female | Dora |
it | male | Giorgio |
it | male | Cosimo |
it | male | Carla |
it | female | Bianca |
it | female | Lucia |
it | female | Gianna |
ja | female | Mizuki |
ja | male | Ichiro |
ja | female | Ayumi |
ja | male | Takumi |
ja | female | Haruka |
kn | female | Namratha |
kn | male | Shashank |
ko | female | Jina |
ko | female | Sumi |
ko | female | Yumi |
ko | female | Seoyeon |
ko | female | Heami |
ko | male | Himchan |
ko | male | Minho |
ml | female | Kirti |
ml | male | Vishnu |
ms | male | Rizwan |
nl | male | Ruben |
nl | female | Lotte |
nl | female | Hanna |
no | female | Hulda |
no | female | Liv |
pl | female | Paulina |
pl | female | Maja |
pl | male | Jan |
pl | male | Jacek |
pl | female | Ewa |
pt-br | female | Vitoria |
pt-br | male | Ricardo |
pt-br | female | Heloisa |
pt-br | male | Daniel |
pt-br | female | Camila |
pt-pt | male | Jeraldo |
pt-pt | female | Jacinda |
pt-pt | male | Henriques |
pt-pt | female | Amalia |
pt-pt | female | Abrielle |
pt-pt | female | Ines |
pt-pt | female | Helia |
pt-pt | male | Cristiano |
ro | female | Carmen |
ro | male | Andrei |
ru | female | Irina |
ru | female | Ekaterina |
ru | male | Maxim |
ru | male | Pavel |
ru | female | Tatyana |
sk | male | Filip |
sl | male | Lado |
sv | female | Astrid |
sv | female | Hedvig |
ta | male | Valluvar |
ta | male | Ganesh |
ta | female | Shruti |
te | male | Vijay |
te | female | Samantha |
te | female | Chitra |
th | male | Pattara |
th | female | Somsi |
tr | female | Filiz |
tr | female | Seda |
vi | female | Lien |
vi | male | Quan |
vi | male | Thao |
vi | female | Mai |
vi | male | An |
wls | female | Gwyneth |
zh-cn | female | Akemi |
zh-cn | male | Wang |
zh-cn | female | Lin |
zh-cn | female | Huihui |
zh-cn | male | Zhang |
zh-cn | female | Liu |
zh-cn | male | Huang |
zh-cn | male | Chen |
zh-cn | female | Zhiyu |
zh-cn | female | Yaoyao |
zh-cn | female | Lily |
zh-cn | male | Kangkang |
zh-tw | female | Hanhan |
zh-tw | female | Yating |
zh-tw | male | Zhiwei |