API di gestione degli utenti in Java
Gestisci le informazioni sugli utenti, conosci il saldo che hai nel tuo account e gestisci i tuoi indirizzi.
Prendere la bilancia dei pagamenti con Java
String afilnet_class="user";
String afilnet_method="getbalance";
String afilnet_user="user";
String afilnet_password="password";
// Create an URL request
String sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password;
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="user";
String afilnet_method="getbalance";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password;
// 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="user";
String afilnet_method="getbalance";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method;
// 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());
}
Impostazione | Descrizione | Obbligatorio / Opzionale |
---|---|---|
class=user | Classe alla quale si realizza la richiesta | Obbligatorio |
method=getbalance | Metodo della classe alla quale si realizza la richiesta | Obbligatorio |
user | L’utente / email del suo conto Afilnet | Obbligatorio |
password | La password del suo conto Afilnet | Obbligatorio |
Risposta:
- stato
-
result (si status=success), ricevera i seguenti valori:
- Non ricevera valori addizionali
- error (si status=error), qui ricevera il codice errore
Codici di errore:
Codice | Descrizione |
---|---|
MISSING_USER | Utente / email non aggiunta |
MISSING_PASSWORD | Password non aggiunta |
MISSING_CLASS | Categoria non inclusa |
MISSING_METHOD | Metodo non incluso |
MISSING_COMPULSORY_PARAM | Impostazione obbligatoria non inclusa |
INCORRECT_USER_PASSWORD | Utente o password incorretti |
INCORRECT_CLASS | Categoria incorretta |
INCORRECT_METHOD | Metodo incorretto |
Aggiungi nuovo indirizzo con Java
String afilnet_class="user";
String afilnet_method="getbalance";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method;
// 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());
}String afilnet_class="user";
String afilnet_method="addaddress";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_namelastname="name+lastname";
String afilnet_iscompany="1";
String afilnet_companyname="mycompany";
String afilnet_documentid="123456789A";
String afilnet_countrycode="us";
String afilnet_cityid="1";
String afilnet_cityname="town";
String afilnet_zipcode="123456";
String afilnet_address="address";
// Create an URL request
String sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&namelastname="+afilnet_namelastname+"&iscompany="+afilnet_iscompany+"&companyname="+afilnet_companyname+"&documentid="+afilnet_documentid+"&countrycode="+afilnet_countrycode+"&cityid="+afilnet_cityid+"&cityname="+afilnet_cityname+"&zipcode="+afilnet_zipcode+"&address="+afilnet_address;
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="user";
String afilnet_method="addaddress";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_namelastname="name+lastname";
String afilnet_iscompany="1";
String afilnet_companyname="mycompany";
String afilnet_documentid="123456789A";
String afilnet_countrycode="us";
String afilnet_cityid="1";
String afilnet_cityname="town";
String afilnet_zipcode="123456";
String afilnet_address="address";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&namelastname="+afilnet_namelastname+"&iscompany="+afilnet_iscompany+"&companyname="+afilnet_companyname+"&documentid="+afilnet_documentid+"&countrycode="+afilnet_countrycode+"&cityid="+afilnet_cityid+"&cityname="+afilnet_cityname+"&zipcode="+afilnet_zipcode+"&address="+afilnet_address;
// 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="user";
String afilnet_method="addaddress";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_namelastname="name+lastname";
String afilnet_iscompany="1";
String afilnet_companyname="mycompany";
String afilnet_documentid="123456789A";
String afilnet_countrycode="us";
String afilnet_cityid="1";
String afilnet_cityname="town";
String afilnet_zipcode="123456";
String afilnet_address="address";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&namelastname="+afilnet_namelastname+"&iscompany="+afilnet_iscompany+"&companyname="+afilnet_companyname+"&documentid="+afilnet_documentid+"&countrycode="+afilnet_countrycode+"&cityid="+afilnet_cityid+"&cityname="+afilnet_cityname+"&zipcode="+afilnet_zipcode+"&address="+afilnet_address;
// 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());
}
Impostazione | Descrizione | Obbligatorio / Opzionale |
---|---|---|
class=user | Classe alla quale si realizza la richiesta | Obbligatorio |
method=addaddress | Metodo della classe alla quale si realizza la richiesta | Obbligatorio |
user | L’utente / email del suo conto Afilnet | Obbligatorio |
password | La password del suo conto Afilnet | Obbligatorio |
namelastname | Nome e cognome della persona di contatto | Obbligatorio |
iscompany | (0) Se è una persona fisica o (1) se è una società | Obbligatorio |
companyname | Nome dell'azienda (nel caso si tratti di un'azienda) | Opzionale |
documentid | Codice documento identificativo della società | Obbligatorio |
countrycode | Codice paese ISO nel formato ISO-3166-1 ALPHA-2 | Obbligatorio |
cityid | Identificatore della città | Obbligatorio |
cityname | Nome della città o paese a cui appartiene | Obbligatorio |
zipcode | codice postale | Obbligatorio |
address | Indirizzo fisico | Obbligatorio |
Risposta:
- stato
-
result (si status=success), ricevera i seguenti valori:
- Non ricevera valori addizionali
- error (si status=error), qui ricevera il codice errore
Codici di errore:
Codice | Descrizione |
---|---|
MISSING_USER | Utente / email non aggiunta |
MISSING_PASSWORD | Password non aggiunta |
MISSING_CLASS | Categoria non inclusa |
MISSING_METHOD | Metodo non incluso |
MISSING_COMPULSORY_PARAM | Impostazione obbligatoria non inclusa |
INCORRECT_USER_PASSWORD | Utente o password incorretti |
INCORRECT_CLASS | Categoria incorretta |
INCORRECT_METHOD | Metodo incorretto |
EMPTY_COUNTRYCODE | Il prefisso internazionale è vuoto |
COUNTRY_NOT_FOUND | Non esiste un paese con il codice indicato |
EMPTY_CITY | Non hai indicato la città |
CITY_NOT_FOUND | La città indicata non esiste |
Rimuovi un indirizzo con Java
String afilnet_class="user";
String afilnet_method="addaddress";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_namelastname="name+lastname";
String afilnet_iscompany="1";
String afilnet_companyname="mycompany";
String afilnet_documentid="123456789A";
String afilnet_countrycode="us";
String afilnet_cityid="1";
String afilnet_cityname="town";
String afilnet_zipcode="123456";
String afilnet_address="address";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&namelastname="+afilnet_namelastname+"&iscompany="+afilnet_iscompany+"&companyname="+afilnet_companyname+"&documentid="+afilnet_documentid+"&countrycode="+afilnet_countrycode+"&cityid="+afilnet_cityid+"&cityname="+afilnet_cityname+"&zipcode="+afilnet_zipcode+"&address="+afilnet_address;
// 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());
}String afilnet_class="user";
String afilnet_method="deleteaddress";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idaddress="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+"&idaddress="+afilnet_idaddress;
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="user";
String afilnet_method="deleteaddress";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idaddress="1000";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&idaddress="+afilnet_idaddress;
// 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="user";
String afilnet_method="deleteaddress";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idaddress="1000";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&idaddress="+afilnet_idaddress;
// 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());
}
Impostazione | Descrizione | Obbligatorio / Opzionale |
---|---|---|
class=user | Classe alla quale si realizza la richiesta | Obbligatorio |
method=deleteaddress | Metodo della classe alla quale si realizza la richiesta | Obbligatorio |
user | L’utente / email del suo conto Afilnet | Obbligatorio |
password | La password del suo conto Afilnet | Obbligatorio |
idaddress | ID indirizzo account utente | Obbligatorio |
Risposta:
- stato
-
result (si status=success), ricevera i seguenti valori:
- Non ricevera valori addizionali
- error (si status=error), qui ricevera il codice errore
Codici di errore:
Codice | Descrizione |
---|---|
MISSING_USER | Utente / email non aggiunta |
MISSING_PASSWORD | Password non aggiunta |
MISSING_CLASS | Categoria non inclusa |
MISSING_METHOD | Metodo non incluso |
MISSING_COMPULSORY_PARAM | Impostazione obbligatoria non inclusa |
INCORRECT_USER_PASSWORD | Utente o password incorretti |
INCORRECT_CLASS | Categoria incorretta |
INCORRECT_METHOD | Metodo incorretto |
Ottieni l'elenco di indirizzi con Java
String afilnet_class="user";
String afilnet_method="deleteaddress";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idaddress="1000";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&idaddress="+afilnet_idaddress;
// 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());
}String afilnet_class="user";
String afilnet_method="getaddresses";
String afilnet_user="user";
String afilnet_password="password";
// Create an URL request
String sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password;
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="user";
String afilnet_method="getaddresses";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password;
// 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="user";
String afilnet_method="getaddresses";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method;
// 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());
}
Impostazione | Descrizione | Obbligatorio / Opzionale |
---|---|---|
class=user | Classe alla quale si realizza la richiesta | Obbligatorio |
method=getaddresses | Metodo della classe alla quale si realizza la richiesta | Obbligatorio |
user | L’utente / email del suo conto Afilnet | Obbligatorio |
password | La password del suo conto Afilnet | Obbligatorio |
Risposta:
- stato
-
result (si status=success), ricevera i seguenti valori:
-
list
- id
- namelastname
- iscompany
- companyname
- documentid
- countrycode
- cityid
- cityname
- zipcode
- address
- verified
- addressverified
-
list
- error (si status=error), qui ricevera il codice errore
Codici di errore:
Codice | Descrizione |
---|---|
MISSING_USER | Utente / email non aggiunta |
MISSING_PASSWORD | Password non aggiunta |
MISSING_CLASS | Categoria non inclusa |
MISSING_METHOD | Metodo non incluso |
MISSING_COMPULSORY_PARAM | Impostazione obbligatoria non inclusa |
INCORRECT_USER_PASSWORD | Utente o password incorretti |
INCORRECT_CLASS | Categoria incorretta |
INCORRECT_METHOD | Metodo incorretto |
Ottieni l'elenco dei canali con Java
String afilnet_class="user";
String afilnet_method="getaddresses";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method;
// 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());
}String afilnet_class="user";
String afilnet_method="getchannels";
String afilnet_user="user";
String afilnet_password="password";
// Create an URL request
String sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password;
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="user";
String afilnet_method="getchannels";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password;
// 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="user";
String afilnet_method="getchannels";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method;
// 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());
}
Impostazione | Descrizione | Obbligatorio / Opzionale |
---|---|---|
class=user | Classe alla quale si realizza la richiesta | Obbligatorio |
method=getchannels | Metodo della classe alla quale si realizza la richiesta | Obbligatorio |
user | L’utente / email del suo conto Afilnet | Obbligatorio |
password | La password del suo conto Afilnet | Obbligatorio |
Risposta:
- stato
-
result (si status=success), ricevera i seguenti valori:
-
list
- channeltype
- channelname
- active
-
list
- error (si status=error), qui ricevera il codice errore
Codici di errore:
Codice | Descrizione |
---|---|
MISSING_USER | Utente / email non aggiunta |
MISSING_PASSWORD | Password non aggiunta |
MISSING_CLASS | Categoria non inclusa |
MISSING_METHOD | Metodo non incluso |
MISSING_COMPULSORY_PARAM | Impostazione obbligatoria non inclusa |
INCORRECT_USER_PASSWORD | Utente o password incorretti |
INCORRECT_CLASS | Categoria incorretta |
INCORRECT_METHOD | Metodo incorretto |
Modifica lo stato di un canale con Java
String afilnet_class="user";
String afilnet_method="getchannels";
String afilnet_user="user";
String afilnet_password="password";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method;
// 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());
}String afilnet_class="user";
String afilnet_method="modifychannel";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_channelname="sms";
String afilnet_active="1";
// Create an URL request
String sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&channelname="+afilnet_channelname+"&active="+afilnet_active;
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="user";
String afilnet_method="modifychannel";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_channelname="sms";
String afilnet_active="1";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&channelname="+afilnet_channelname+"&active="+afilnet_active;
// 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="user";
String afilnet_method="modifychannel";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_channelname="sms";
String afilnet_active="1";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&channelname="+afilnet_channelname+"&active="+afilnet_active;
// 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());
}
Impostazione | Descrizione | Obbligatorio / Opzionale |
---|---|---|
class=user | Classe alla quale si realizza la richiesta | Obbligatorio |
method=modifychannel | Metodo della classe alla quale si realizza la richiesta | Obbligatorio |
user | L’utente / email del suo conto Afilnet | Obbligatorio |
password | La password del suo conto Afilnet | Obbligatorio |
channelname | Nome del canale | Obbligatorio |
active | (1) Abilita o (0) Disabilita | Obbligatorio |
Risposta:
- stato
-
result (si status=success), ricevera i seguenti valori:
- Non ricevera valori addizionali
- error (si status=error), qui ricevera il codice errore
Codici di errore:
Codice | Descrizione |
---|---|
MISSING_USER | Utente / email non aggiunta |
MISSING_PASSWORD | Password non aggiunta |
MISSING_CLASS | Categoria non inclusa |
MISSING_METHOD | Metodo non incluso |
MISSING_COMPULSORY_PARAM | Impostazione obbligatoria non inclusa |
INCORRECT_USER_PASSWORD | Utente o password incorretti |
INCORRECT_CLASS | Categoria incorretta |
INCORRECT_METHOD | Metodo incorretto |
Quale API per Java dovrei usare?
Scopri i vantaggi e gli svantaggi di ciascuna delle nostre API. Scopri quale API è la migliore per il tuo software in Java.
Questa API ti consente di connetterti a noi da Java per inviare richieste tramite richieste HTTP GET. Questa richiesta invia i parametri nello stesso URL della richiesta.
- HTTP GET è estremamente semplice da implementare
- Le informazioni vengono inviate non crittografate (le password possono essere estratte dai registri o dalla cache)
- Richiesta massima di ~4000 caratteri
L'API di richiesta POST ti consente di connetterti alla nostra API da Java inviando parametri di richiesta tramite parametri POST HTTP. Le informazioni vengono inviate indipendentemente dall'URL.
- HTTP POST è semplice da implementare
- Le informazioni vengono inviate crittografate
- Non c'è limite alla dimensione della richiesta
- Sicurezza media
L'API di autenticazione di base consente l'utilizzo di richieste GET e POST in Java con un livello di sicurezza aggiuntivo, poiché in questo caso nome utente e password vengono inviati nell'intestazione della richiesta.
- L'autenticazione di base è facile da implementare
- I dati di accesso vengono inviati crittografati
- Il limite di dimensione dipende dall'uso di GET o POST
- Sicurezza media
SOAP ti consente di inviare richieste in formato XML con Java, SOAP aggiunge un ulteriore livello di sicurezza alle richieste API.
- L'integrazione di SOAP è più complessa
- Le informazioni vengono inviate crittografate
- Non c'è limite alla dimensione della richiesta
- Sicurezza medio/alta
La nostra API JSON ti consente di inviare richieste in formato JSON con Java, inoltre questa API aggiunge il protocollo oAuth 2.0 nell'autenticazione che ti consente di aggiungere un ulteriore livello di sicurezza.
- L'integrazione di JSON oAuth 2.0 è più complessa
- Le informazioni vengono inviate crittografate
- Non c'è limite alla dimensione della richiesta
- Alta sicurezza
Connetti Java con la nostra API Utente
Registrati come cliente
Per poter accedere all'API devi essere un client Afilnet. La registrazione richiederà alcuni minuti.
Richiedi la tua prova gratuita
La nostra azienda ti offrirà un saldo di prova che ti consentirà di testare con l'API di cui hai bisogno.
Integra l'API
Esegui l'integrazione API utilizzando il linguaggio di programmazione di tua scelta. Se hai domande o suggerimenti sull'API, contattaci
Benvenuti in Afilnet!
Tutto pronto!, È riuscito a migliorare le sue comunicazioni con Afilnet. Siamo qui per supportare la nostra API quando ne hai bisogno
Contatta il nostro team per qualsiasi domanda tramite i metodi di contatto che offriamo. Il nostro team cercherà di offrirti una soluzione immediata e ti aiuterà nell'integrazione della nostra API nel tuo Software.