Feld zu einer Gruppe hinzufügen mit Java
Fügen Sie eine Spalte zu einer Kontaktgruppe hinzu mit Java
Java : API-DOKUMENTATION
- Gruppe anlegen mit Java
- Felder aus einer Gruppe abrufen mit Java
- Feld zu einer Gruppe hinzufügen mit Java
- Feld aus einer Gruppe entfernen mit Java
- Einen Kontakt aus einer Gruppe löschen
- Land einer Gruppe zuordnen mit Java
- Kontakte der Gruppe abrufen mit Java
- Kontakt zur Gruppe hinzufügen mit Java
- Kontakt der Gruppe ändern mit Java
- Kontakt aus der Gruppe entfernen mit Java
- Holen Sie sich eine Liste der aktiven Chat-Kanäle mit Java
- Senden Sie eine Nachricht per Chat mit Java
- Senden Sie eine Datei per Chat mit Java
- Holen Sie sich eine Liste der Konversationen in einem Chat mit Java
- Liste der Nachrichten aus einem Chat mit Java abrufen
- Holen Sie sich eine Liste ungelesener Nachrichten aus einem Chat mit Java
Feld zu einer Gruppe hinzufügen mit Java
String afilnet_class="group";
String afilnet_method="addcolumntogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="1000";
String afilnet_field="name";
// 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+"&field="+afilnet_field;
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="addcolumntogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="1000";
String afilnet_field="name";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&idgroup="+afilnet_idgroup+"&field="+afilnet_field;
// 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="addcolumntogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="1000";
String afilnet_field="name";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&idgroup="+afilnet_idgroup+"&field="+afilnet_field;
// 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());
}
Parameter | Beschreibung | Zwigend / optional |
---|---|---|
class=group | Sorte deren Antragen sich realisiert | Zwigend |
method=addcolumntogroup | Sortenmethode deren Antragen sich realisiert | Zwigend |
user | Der User / Email Ihres Afilnet Account | Zwigend |
password | Das password Ihres Afilnet Account | Zwigend |
idgroup | Gruppenkennung | Zwigend |
field | Gruppenfelder | Zwigend |
Aus Sie die Anfragen verwenden,werden Sie die nächster Datenfeld bekommen:
- status
-
result (si status=success), Sie werden die nächsten Codes bekommen:
- Sie werden kein Grenzkosten bekommen
- Fehler (si status=Fehler), hier werden Sie der Fehlercode bekommen
Die mögliche Fehlercode sind die nächster:
Code | Beschreibung |
---|---|
MISSING_USER | User / email nicht beiliegend |
MISSING_PASSWORD | Password nicht beiliegend |
MISSING_CLASS | Sorten nicht beiliegend |
MISSING_METHOD | Methode nicht beiliegend |
MISSING_COMPULSORY_PARAM | Parameterversicherung nicht beiliegend |
INCORRECT_USER_PASSWORD | User oder Passwort inkorrekt |
INCORRECT_CLASS | Inkorrekt Sorte |
INCORRECT_METHOD | Inkorrekt Methode |
NOT_ACCESS_TO_GROUP | Sie verfügt nicht auf die Erlaubnis für die geeignet Gruppe |
Parameter:
- class : group
- method : addcolumntogroup
- user : user
- password : password
- idgroup : 1000
- field : name
Anforderung:
https://www.afilnet.com/api/http/?class=group&method=addcolumntogroup&user=user&password=password&idgroup=1000&field=name