Smazat kontakt ze skupiny s Java
Smazání kontaktu skupiny 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
Smazat kontakt ze skupiny s Java
String afilnet_class="group";
String afilnet_method="deletecontact";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="1000";
String afilnet_idcontact="1000";
// Create an URL request
String sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&idgroup="+afilnet_idgroup+"&idcontact="+afilnet_idcontact;
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="group";
String afilnet_method="deletecontact";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="1000";
String afilnet_idcontact="1000";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&idgroup="+afilnet_idgroup+"&idcontact="+afilnet_idcontact;
// 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="group";
String afilnet_method="deletecontact";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="1000";
String afilnet_idcontact="1000";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&idgroup="+afilnet_idgroup+"&idcontact="+afilnet_idcontact;
// 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=group | Požadovaná třída: Třída, na kterou je žádost podána | Povinný |
method=deletecontact | 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ý |
idgroup | ID skupiny | Povinný |
idcontact | Kontaktní ID | Povinný |
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:
- Nebudou vám zasílány žádné další hodnoty
- 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í |
Parametry:
- class : group
- method : deletecontact
- user : user
- password : password
- idgroup : 1000
- idcontact : 1000
Žádost:
https://www.afilnet.com/api/http/?class=group&method=deletecontact&user=user&password=password&idgroup=1000&idcontact=1000