أرسل رسالة نصية من القالب مع python
إرسال قالب SMS باستخدام HTTP مع python
python : وثائق API
- إنشاء مجموعة باستخدام python
- الحصول على قائمة حقول المجموعة باستخدام python
- إضافة حقل إلى مجموعة بها python
- حذف حقل من مجموعة بها python
- حذف جهة اتصال من مجموعة
- عيّن البلد إلى مجموعة بها python
- الحصول على قائمة جهات اتصال المجموعة باستخدام python
- إضافة جهة اتصال إلى مجموعة بها python
- تعديل جهة اتصال مجموعة بها python
- حذف جهة اتصال لمجموعة بها python
أرسل رسالة نصية من القالب مع python
import urllib2
afilnet_class="sms"
afilnet_method="sendsmsfromtemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_to="34600000000"
afilnet_idtemplate="1000"
afilnet_params="mobile:123456789,name:test+name"
afilnet_scheduledatetime=""
afilnet_output=""
# Create an URL request
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
result = urllib2.urlopen(sUrl).read()
from urllib.request import urlopen
from urllib.parse import urlencode
afilnet_class="sms"
afilnet_method="sendsmsfromtemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_to="34600000000"
afilnet_idtemplate="1000"
afilnet_params="mobile:123456789,name:test+name"
afilnet_scheduledatetime=""
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/"
data = urlencode({"class": afilnet_class,"method": afilnet_method,"user": afilnet_user,"password": afilnet_password,"to": afilnet_to,"idtemplate": afilnet_idtemplate,"params": afilnet_params,"scheduledatetime": afilnet_scheduledatetime,"output": afilnet_output}).encode("utf-8")
result = urlopen(sUrl, data).read()
print(result)
import requests
afilnet_class="sms"
afilnet_method="sendsmsfromtemplate"
afilnet_user="user"
afilnet_password="password"
afilnet_to="34600000000"
afilnet_idtemplate="1000"
afilnet_params="mobile:123456789,name:test+name"
afilnet_scheduledatetime=""
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/basic/?class="+afilnet_class+"&method="+afilnet_method+"&to="+afilnet_to+"&idtemplate="+afilnet_idtemplate+"¶ms="+afilnet_params+"&scheduledatetime="+afilnet_scheduledatetime+"&output="+afilnet_output
result = requests.get(sUrl,auth=requests.auth.HTTPBasicAuth(afilnet_user,afilnet_password))
print(result.text)
معامل | وصف | إجباري / اختياري |
---|---|---|
class=sms | الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها | إلزامي |
method=sendsmsfromtemplate | طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه | إلزامي |
user | المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك | إلزامي |
password | كلمة المرور لحساب Afilnet الخاص بك | إلزامي |
to | رقم الجوال | إلزامي |
idtemplate | معرف القالب | إلزامي |
params |
المعلمات التي سيتم استبدالها في قالب التخصيص (< |
اختياري |
scheduledatetime | تاريخ التسليم والوقت بالتنسيق yyyy-mm-dd hh:mm:ss | اختياري |
output | تنسيق الإخراج من النتيجة | اختياري |
عند تقديم طلبات ، ستتلقى الحقول التالية:
- status
-
النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
- 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 | لا يمكنك الوصول إلى القالب المحدد |
المعلمات:
- class : sms
- method : sendsmsfromtemplate
- user : user
- password : password
- to : 34600000000
- idtemplate : 1000
- params : mobile:123456789,name:test+name
- scheduledatetime :
- output :
طلب:
https://www.afilnet.com/api/http/?class=sms&method=sendsmsfromtemplate&user=user&password=password&to=34600000000&idtemplate=1000¶ms=mobile:123456789,name:test+name&scheduledatetime=&output=