SMS API لـ Java

أرسل رسائل SMS باستخدام واجهة برمجة التطبيقات الخاصة بنا لـ Java بسهولة وأمان. جرب API الخاص بنا لـ Java مجانًا. سيساعدك فريقنا على دمج إرسال الرسائل القصيرة في تطبيقك في Java.

وظائف API SMS

إرسال الرسائل القصيرة مع Java

Este método le permite enviar SMS a un destinatario utilizando Java. Enviar un SMS con Java es tan sencillo como enviar el origin, destino y el mensaje a enviar a través de una petición a nuestra API.
String afilnet_class="sms";
String afilnet_method="sendsms";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="Afilnet";
String afilnet_to="34600000000";
String afilnet_sms="sms+test";
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+"&to="+afilnet_to+"&sms="+afilnet_sms+"&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="sms";
String afilnet_method="sendsms";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="Afilnet";
String afilnet_to="34600000000";
String afilnet_sms="sms+test";
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+"&to="+afilnet_to+"&sms="+afilnet_sms+"&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="sms";
String afilnet_method="sendsms";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="Afilnet";
String afilnet_to="34600000000";
String afilnet_sms="sms+test";
String afilnet_scheduledatetime="";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&from="+afilnet_from+"&to="+afilnet_to+"&sms="+afilnet_sms+"&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());  
}
معامل وصف إجباري / اختياري
class=sms الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها إلزامي
method=sendsms طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه إلزامي
user المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك إلزامي
password كلمة المرور لحساب Afilnet الخاص بك إلزامي
from مرسل إلزامي
to رقم الهاتف المحمول للمستلم إلزامي
sms رسالة نصية ليتم إرسالها إلزامي
scheduledatetime إرسال التاريخ والوقت بتنسيق yyyy-mm-dd hh:mm:ss اختياري
output تنسيق الإخراج من النتيجة اختياري
إجابه:
  • الحالة
  • النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
    • messageid
    • credits
  • خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ

رموز الخطأ:
الشفرة وصف
MISSING_USER المستخدم أو البريد الإلكتروني غير المدرجة
MISSING_PASSWORD كلمة المرور غير المدرجة
MISSING_CLASS الطبقة غير المدرجة
MISSING_METHOD طريقة غير المدرجة
MISSING_COMPULSORY_PARAM المعلمة الإجبارية غير المدرجة
INCORRECT_USER_PASSWORD مستخدم غير صحيح أو كلمة المرور
INCORRECT_CLASS فئة غير صحيحة
INCORRECT_METHOD طريقة غير صحيحة
NO_ROUTE_AVAILABLE لا توجد مسارات متاحة للوجهة المشار إليها
NO_CREDITS رصيدك غير كافٍ

أرسل رسالة نصية من القالب مع Java

String afilnet_class="sms";
String afilnet_method="sendsms";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="Afilnet";
String afilnet_to="34600000000";
String afilnet_sms="sms+test";
String afilnet_scheduledatetime="";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&from="+afilnet_from+"&to="+afilnet_to+"&sms="+afilnet_sms+"&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());  
}String afilnet_class="sms";
String afilnet_method="sendsmsfromtemplate";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_to="34600000000";
String afilnet_idtemplate="1000";
String afilnet_params="mobile:123456789,name:test+name";
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+"&to="+afilnet_to+"&idtemplate="+afilnet_idtemplate+"¶ms="+afilnet_params+"&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="sms";
String afilnet_method="sendsmsfromtemplate";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_to="34600000000";
String afilnet_idtemplate="1000";
String afilnet_params="mobile:123456789,name:test+name";
String afilnet_scheduledatetime="";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&to="+afilnet_to+"&idtemplate="+afilnet_idtemplate+"¶ms="+afilnet_params+"&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="sms";
String afilnet_method="sendsmsfromtemplate";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_to="34600000000";
String afilnet_idtemplate="1000";
String afilnet_params="mobile:123456789,name:test+name";
String afilnet_scheduledatetime="";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&to="+afilnet_to+"&idtemplate="+afilnet_idtemplate+"¶ms="+afilnet_params+"&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());  
}
معامل وصف إجباري / اختياري
class=sms الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها إلزامي
method=sendsmsfromtemplate طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه إلزامي
user المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك إلزامي
password كلمة المرور لحساب Afilnet الخاص بك إلزامي
to رقم الجوال إلزامي
idtemplate معرف القالب إلزامي
params المعلمات التي سيتم استبدالها في قالب التخصيص (< >) ، مفصولة بـ ، (فواصل) اختياري
scheduledatetime تاريخ التسليم والوقت بالتنسيق yyyy-mm-dd hh:mm:ss اختياري
output تنسيق الإخراج من النتيجة اختياري
إجابه:
  • الحالة
  • النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
    • messageid
    • credits
  • خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ

رموز الخطأ:
الشفرة وصف
MISSING_USER المستخدم أو البريد الإلكتروني غير المدرجة
MISSING_PASSWORD كلمة المرور غير المدرجة
MISSING_CLASS الطبقة غير المدرجة
MISSING_METHOD طريقة غير المدرجة
MISSING_COMPULSORY_PARAM المعلمة الإجبارية غير المدرجة
INCORRECT_USER_PASSWORD مستخدم غير صحيح أو كلمة المرور
INCORRECT_CLASS فئة غير صحيحة
INCORRECT_METHOD طريقة غير صحيحة
NO_ROUTE_AVAILABLE لا توجد مسارات متاحة للوجهة المشار إليها
NO_CREDITS رصيدك غير كافٍ
NOT_ACCESS_TO_TEMPLATE لا يمكنك الوصول إلى القالب المحدد

إرسال رسائل نصية مجمعة مع Java

Con este método puede enviar con Java campañas de SMS Masivo a grupos de contactos que haya creado. Incluya el grupo, el prefijo del país, el remitente, el SMS a enviar. Este método le permite enviar campañas de SMS Masivo sin limite de destinatarios con Java.
String afilnet_class="sms";
String afilnet_method="sendsmsfromtemplate";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_to="34600000000";
String afilnet_idtemplate="1000";
String afilnet_params="mobile:123456789,name:test+name";
String afilnet_scheduledatetime="";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&to="+afilnet_to+"&idtemplate="+afilnet_idtemplate+"¶ms="+afilnet_params+"&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());  
}String afilnet_class="sms";
String afilnet_method="sendsmstogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="Afilnet";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_sms="sms+test";
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+"&sms="+afilnet_sms+"&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="sms";
String afilnet_method="sendsmstogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="Afilnet";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_sms="sms+test";
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+"&sms="+afilnet_sms+"&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="sms";
String afilnet_method="sendsmstogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="Afilnet";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_sms="sms+test";
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+"&sms="+afilnet_sms+"&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());  
}
معامل وصف إجباري / اختياري
class=sms الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها إلزامي
method=sendsmstogroup طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه إلزامي
user المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك إلزامي
password كلمة المرور لحساب Afilnet الخاص بك إلزامي
from مرسل إلزامي
countrycode رمز الاتصال بالدولة إلزامي
idgroup معرف مجموعة المستلم إلزامي
sms رسالة نصية ليتم إرسالها إلزامي
scheduledatetime تاريخ ووقت التسليم بتنسيق yyyy-mm-dd hh:mm:ss اختياري
output تنسيق الإخراج من النتيجة اختياري
إجابه:
  • الحالة
  • النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
    • id
    • count
    • credits
    • destinations
      • messageid
      • destination
  • خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ

رموز الخطأ:
الشفرة وصف
MISSING_USER المستخدم أو البريد الإلكتروني غير المدرجة
MISSING_PASSWORD كلمة المرور غير المدرجة
MISSING_CLASS الطبقة غير المدرجة
MISSING_METHOD طريقة غير المدرجة
MISSING_COMPULSORY_PARAM المعلمة الإجبارية غير المدرجة
INCORRECT_USER_PASSWORD مستخدم غير صحيح أو كلمة المرور
INCORRECT_CLASS فئة غير صحيحة
INCORRECT_METHOD طريقة غير صحيحة
NOT_ACCESS_TO_GROUP غير مسموح لك بالدخول إلى المجموعة المشار إليها
NO_CREDITS رصيدك غير كافٍ

إرسال رسائل نصية مجمعة من القالب باستخدام Java

String afilnet_class="sms";
String afilnet_method="sendsmstogroup";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_from="Afilnet";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_sms="sms+test";
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+"&sms="+afilnet_sms+"&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());  
}String afilnet_class="sms";
String afilnet_method="sendsmstogroupfromtemplate";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_idtemplate="1000";
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+"&countrycode="+afilnet_countrycode+"&idgroup="+afilnet_idgroup+"&idtemplate="+afilnet_idtemplate+"&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="sms";
String afilnet_method="sendsmstogroupfromtemplate";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_idtemplate="1000";
String afilnet_scheduledatetime="";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&countrycode="+afilnet_countrycode+"&idgroup="+afilnet_idgroup+"&idtemplate="+afilnet_idtemplate+"&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="sms";
String afilnet_method="sendsmstogroupfromtemplate";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_idtemplate="1000";
String afilnet_scheduledatetime="";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&countrycode="+afilnet_countrycode+"&idgroup="+afilnet_idgroup+"&idtemplate="+afilnet_idtemplate+"&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());  
}
معامل وصف إجباري / اختياري
class=sms الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها إلزامي
method=sendsmstogroupfromtemplate طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه إلزامي
user المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك إلزامي
password كلمة المرور لحساب Afilnet الخاص بك إلزامي
countrycode الرقم الدولي إلزامي
idgroup معرف مجموعة الوجهة إلزامي
idtemplate معرف القالب إلزامي
scheduledatetime تاريخ التسليم والوقت بالتنسيق yyyy-mm-dd hh:mm:ss اختياري
output تنسيق الإخراج من النتيجة اختياري
إجابه:
  • الحالة
  • النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
    • id
    • count
    • credits
    • destinations
      • messageid
      • destination
  • خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ

رموز الخطأ:
الشفرة وصف
MISSING_USER المستخدم أو البريد الإلكتروني غير المدرجة
MISSING_PASSWORD كلمة المرور غير المدرجة
MISSING_CLASS الطبقة غير المدرجة
MISSING_METHOD طريقة غير المدرجة
MISSING_COMPULSORY_PARAM المعلمة الإجبارية غير المدرجة
INCORRECT_USER_PASSWORD مستخدم غير صحيح أو كلمة المرور
INCORRECT_CLASS فئة غير صحيحة
INCORRECT_METHOD طريقة غير صحيحة
NOT_ACCESS_TO_GROUP غير مسموح لك بالدخول إلى المجموعة المشار إليها
NO_CREDITS رصيدك غير كافٍ

الحصول على حالة تسليم الرسائل النصية القصيرة باستخدام Java

String afilnet_class="sms";
String afilnet_method="sendsmstogroupfromtemplate";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_countrycode="34";
String afilnet_idgroup="1";
String afilnet_idtemplate="1000";
String afilnet_scheduledatetime="";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&countrycode="+afilnet_countrycode+"&idgroup="+afilnet_idgroup+"&idtemplate="+afilnet_idtemplate+"&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());  
}String afilnet_class="sms";
String afilnet_method="getdeliverystatus";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_messages="123456,123457,123458";
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+"&messages="+afilnet_messages+"&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="sms";
String afilnet_method="getdeliverystatus";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_messages="123456,123457,123458";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&messages="+afilnet_messages+"&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="sms";
String afilnet_method="getdeliverystatus";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_messages="123456,123457,123458";
String afilnet_output="";

// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&messages="+afilnet_messages+"&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());  
}
معامل وصف إجباري / اختياري
class=sms الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها إلزامي
method=getdeliverystatus طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه إلزامي
user المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك إلزامي
password كلمة المرور لحساب Afilnet الخاص بك إلزامي
messages قائمة معرفات الإرسال مفصولة بفواصل (،) إلزامي
output تنسيق الإخراج من النتيجة اختياري
إجابه:
  • الحالة
  • النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
    • messageid
    • sms
    • deliverydate
    • deliverystatus
  • خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ

رموز الخطأ:
الشفرة وصف
MISSING_USER المستخدم أو البريد الإلكتروني غير المدرجة
MISSING_PASSWORD كلمة المرور غير المدرجة
MISSING_CLASS الطبقة غير المدرجة
MISSING_METHOD طريقة غير المدرجة
MISSING_COMPULSORY_PARAM المعلمة الإجبارية غير المدرجة
INCORRECT_USER_PASSWORD مستخدم غير صحيح أو كلمة المرور
INCORRECT_CLASS فئة غير صحيحة
INCORRECT_METHOD طريقة غير صحيحة

SMS API لـ

إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ PHP إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Java إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ C Sharp إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Unix إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ ruby on rails إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ python إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Android إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Objective C / iPhone إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ SQL Server إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Oracle إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Node JS إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Go إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Scala إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Swift إرجاع حالة تسليم الرسائل القصيرة المعتمدة بـ Delphi

تقدم لك Afilnet طرقًا لتحسين الأمان عند استخدام واجهة برمجة التطبيقات الخاصة بنا مع {اللغة} ، وذلك بفضل إمكانية إنشاء عمليات الوصول وإمكانية تنشيط التصفية بواسطة IP.

أي واجهة برمجة تطبيقات للغة {اللغة} يجب أن أستخدمها؟

اكتشف مزايا وعيوب كل من واجهات برمجة التطبيقات الخاصة بنا. اكتشف واجهة برمجة التطبيقات الأفضل لبرنامجك في {اللغة}.

تتيح لك واجهة برمجة التطبيقات هذه الاتصال بنا من Java لإرسال الطلبات عبر طلبات HTTP GET. يرسل هذا الطلب المعلمات في نفس عنوان URL مثل الطلب.

  • HTTP GET سهل التنفيذ للغاية
  • يتم إرسال المعلومات بدون تشفير (يمكن استخراج كلمات المرور من السجلات أو ذاكرة التخزين المؤقت)
  • الحد الأقصى للطلب حوالي 4000 حرف

تسمح لك واجهة برمجة تطبيقات طلب POST بالاتصال بواجهة برمجة التطبيقات الخاصة بنا من Java عن طريق إرسال معلمات الطلب عبر معلمات HTTP POST. يتم إرسال المعلومات بشكل مستقل عن URL.

  • HTTP POST سهل التنفيذ
  • يتم إرسال المعلومات مشفرة
  • لا يوجد حد لحجم الطلب
  • أمان متوسط

تسمح واجهة برمجة تطبيقات المصادقة الأساسية باستخدام طلبات GET و POST باللغة Java مع طبقة أمان إضافية ، لأنه في هذه الحالة يتم إرسال اسم المستخدم وكلمة المرور في رأس الطلب.

  • المصادقة الأساسية سهلة التنفيذ
  • يتم إرسال بيانات الوصول مشفرة
  • يعتمد حد الحجم على استخدام GET أو POST
  • أمان متوسط

يتيح لك SOAP إرسال طلبات بتنسيق XML مع Java ، ويضيف SOAP طبقة أمان إضافية لطلبات API.

  • يعتبر تكامل SOAP أكثر تعقيدًا
  • يتم إرسال المعلومات مشفرة
  • لا يوجد حد لحجم الطلب
  • متوسطة / عالية الأمان

تتيح لك واجهة برمجة تطبيقات JSON الخاصة بنا إرسال الطلبات بتنسيق JSON مع {اللغة} ، بالإضافة إلى أن واجهة برمجة التطبيقات هذه تضيف بروتوكول oAuth 2.0 في المصادقة التي تتيح لك إضافة طبقة أمان إضافية.

  • يعتبر تكامل JSON oAuth 2.0 أكثر تعقيدًا
  • يتم إرسال المعلومات مشفرة
  • لا يوجد حد لحجم الطلب
  • حماية عالية

ربط Java بواجهة برمجة التطبيقات رسالة قصيرة الخاصة بنا

تتيح لك SMS API الخاصة بنا إرسال رسائل SMS أو تشغيل الحملات بسهولة وسرعة وكفاءة. لن تستغرق العملية التي يتعين عليك اتباعها لتتمكن من استخدام واجهة برمجة التطبيقات الخاصة بنا سوى بضع دقائق. ستقدم لك شركتنا إصدارًا تجريبيًا مجانيًا حتى تتمكن من إرسال الرسائل القصيرة باستخدام Java.

01

سجل كعميل

من أجل الوصول إلى API ، يجب أن تكون عميل Afilnet. سيستغرق التسجيل بضع دقائق.

02

طلب نسخة تجريبية مجانية

ستقدم لك شركتنا رصيدًا تجريبيًا يتيح لك الاختبار باستخدام واجهة برمجة التطبيقات التي تحتاجها.

03

دمج API

قم بإجراء تكامل API باستخدام لغة البرمجة التي تختارها. إذا كان لديك أي أسئلة أو اقتراحات حول API ، فاتصل بنا

04

مرحبا بكم في Afilnet!

كل شيء جاهز! ، تمكن من تحسين اتصالاته مع Afilnet. نحن هنا لدعم API لدينا عند الحاجة إليها


تواصل مع فريقنا لطرح أي أسئلة من خلال طرق الاتصال التي نقدمها. سيحاول فريقنا أن يقدم لك حلاً فوريًا وسيساعدك في دمج API الخاص بنا في برنامجك.

جرب Afilnet مجانًا!

سجل مجانا وجرب Afilnet! نحن نقدم لك نسخة تجريبية مجانية من خدماتنا. *



(*) الترويج صالح فقط للشركات التي لم تستخدم خدمة Afilnet من قبل. عند طلب الرصيد المجاني ، قد تطلب Afilnet التحقق من معلومات شركتك


الرسائل القصيرة بالجملة · التسويق عبر البريد الإلكتروني · شبكة اجتماعية · رسالة فورية · شهادة · وأكثر بكثير
استمر معلومات مهمة حول ملفات تعريف الارتباط: إذا واصلت استخدام هذا الويب ، فسنفترض أنك تقبل شروط الاستخدام. ستجد المزيد من المعلومات في سياسة ملفات تعريف الارتباط الخاصة بنا.
طرق الدفع
تحويلة كهربية بالسلك
بطاقة إئتمان
Paypal
Western Union
Skrill
Crypto
Afilnet بلغتك

Copyright © 2023 Afilnet · كل الحقوق محفوظة