إضافة حساب فرعي بـ python
إضافة حساب فرعي بـ python
python : وثائق API
- إنشاء مجموعة باستخدام python
- الحصول على قائمة حقول المجموعة باستخدام python
- إضافة حقل إلى مجموعة بها python
- حذف حقل من مجموعة بها python
- حذف جهة اتصال من مجموعة
- عيّن البلد إلى مجموعة بها python
- الحصول على قائمة جهات اتصال المجموعة باستخدام python
- إضافة جهة اتصال إلى مجموعة بها python
- تعديل جهة اتصال مجموعة بها python
- حذف جهة اتصال لمجموعة بها python
إضافة حساب فرعي بـ python
import urllib2
afilnet_class="subaccount"
afilnet_method="addsubaccount"
afilnet_user="user"
afilnet_password="password"
afilnet_accountemail="email@email.com"
afilnet_accountpassword="password"
afilnet_namelastname="name+lastname"
afilnet_iscompany="1"
afilnet_companyname="mycompany"
afilnet_documentid="123456789A"
afilnet_language="en"
afilnet_countrycode="us"
afilnet_cityid="1"
afilnet_cityname="town"
afilnet_zipcode="123456"
afilnet_address="address"
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&accountemail="+afilnet_accountemail+"&accountpassword="+afilnet_accountpassword+"&namelastname="+afilnet_namelastname+"&iscompany="+afilnet_iscompany+"&companyname="+afilnet_companyname+"&documentid="+afilnet_documentid+"&language="+afilnet_language+"&countrycode="+afilnet_countrycode+"&cityid="+afilnet_cityid+"&cityname="+afilnet_cityname+"&zipcode="+afilnet_zipcode+"&address="+afilnet_address
result = urllib2.urlopen(sUrl).read()
from urllib.request import urlopen
from urllib.parse import urlencode
afilnet_class="subaccount"
afilnet_method="addsubaccount"
afilnet_user="user"
afilnet_password="password"
afilnet_accountemail="email@email.com"
afilnet_accountpassword="password"
afilnet_namelastname="name+lastname"
afilnet_iscompany="1"
afilnet_companyname="mycompany"
afilnet_documentid="123456789A"
afilnet_language="en"
afilnet_countrycode="us"
afilnet_cityid="1"
afilnet_cityname="town"
afilnet_zipcode="123456"
afilnet_address="address"
# 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,"accountemail": afilnet_accountemail,"accountpassword": afilnet_accountpassword,"namelastname": afilnet_namelastname,"iscompany": afilnet_iscompany,"companyname": afilnet_companyname,"documentid": afilnet_documentid,"language": afilnet_language,"countrycode": afilnet_countrycode,"cityid": afilnet_cityid,"cityname": afilnet_cityname,"zipcode": afilnet_zipcode,"address": afilnet_address}).encode("utf-8")
result = urlopen(sUrl, data).read()
print(result)
import requests
afilnet_class="subaccount"
afilnet_method="addsubaccount"
afilnet_user="user"
afilnet_password="password"
afilnet_accountemail="email@email.com"
afilnet_accountpassword="password"
afilnet_namelastname="name+lastname"
afilnet_iscompany="1"
afilnet_companyname="mycompany"
afilnet_documentid="123456789A"
afilnet_language="en"
afilnet_countrycode="us"
afilnet_cityid="1"
afilnet_cityname="town"
afilnet_zipcode="123456"
afilnet_address="address"
# Create an URL request
sUrl = "https://www.afilnet.com/api/basic/?class="+afilnet_class+"&method="+afilnet_method+"&accountemail="+afilnet_accountemail+"&accountpassword="+afilnet_accountpassword+"&namelastname="+afilnet_namelastname+"&iscompany="+afilnet_iscompany+"&companyname="+afilnet_companyname+"&documentid="+afilnet_documentid+"&language="+afilnet_language+"&countrycode="+afilnet_countrycode+"&cityid="+afilnet_cityid+"&cityname="+afilnet_cityname+"&zipcode="+afilnet_zipcode+"&address="+afilnet_address
result = requests.get(sUrl,auth=requests.auth.HTTPBasicAuth(afilnet_user,afilnet_password))
print(result.text)
معامل | وصف | إجباري / اختياري |
---|---|---|
class=subaccount | الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها | إلزامي |
method=addsubaccount | طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه | إلزامي |
user | المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك | إلزامي |
password | كلمة المرور لحساب Afilnet الخاص بك | إلزامي |
accountemail | حساب البريد الإلكتروني | إلزامي |
accountpassword | كلمة مرور الحساب | إلزامي |
namelastname | اسم ولقب الشخص المسؤول | إلزامي |
iscompany | (0) إذا كان شخصًا طبيعيًا أو (1) إذا كانت شركة | إلزامي |
companyname | اسم الشركة (في حال كانت شركة) | اختياري |
documentid | كود وثيقة تعريف الشركة | إلزامي |
language | لغة الحساب الفرعي. انظر الجدول المرفق | إلزامي |
countrycode | رمز البلد ISO بتنسيق ISO-3166-1 ALPHA-2 | إلزامي |
cityid | معرف المدينة | إلزامي |
cityname | اسم المدينة أو البلدة التي تنتمي إليها | إلزامي |
zipcode | رمز بريدي | إلزامي |
address | العنوان الفعلي | إلزامي |
عند تقديم طلبات ، ستتلقى الحقول التالية:
- status
-
النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
- لن يتم إرسال قيم إضافية إليك
- خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ
يتم سرد رموز الأخطاء المحتملة أدناه
الشفرة | وصف |
---|---|
MISSING_USER | المستخدم أو البريد الإلكتروني غير المدرجة |
MISSING_PASSWORD | كلمة المرور غير المدرجة |
MISSING_CLASS | الطبقة غير المدرجة |
MISSING_METHOD | طريقة غير المدرجة |
MISSING_COMPULSORY_PARAM | المعلمة الإجبارية غير المدرجة |
INCORRECT_USER_PASSWORD | مستخدم غير صحيح أو كلمة المرور |
INCORRECT_CLASS | فئة غير صحيحة |
INCORRECT_METHOD | طريقة غير صحيحة |
EMPTY_COUNTRYCODE | رمز البلد فارغ |
EMPTY_FIELDS | بعض الحقول الإلزامية فارغة |
COUNTRY_NOT_FOUND | لا توجد دولة مع الرمز المشار إليه |
EMPTY_CITY | لم تحدد المدينة |
CITY_NOT_FOUND | المدينة المشار إليها غير موجودة |
INCORRECT_EMAIL | البريد الإلكتروني المتضمن غير صالح |
INCORRECT_PASSWORD | كلمة المرور المضمنة غير صالحة |
RESELLER_ACCOUNT_REQUIRED | حساب المستخدم ليس به خطة المورِّد نشطة |
المعلمات:
- class : subaccount
- method : addsubaccount
- user : user
- password : password
- accountemail : email@email.com
- accountpassword : password
- namelastname : name+lastname
- iscompany : 1
- companyname : mycompany
- documentid : 123456789A
- language : en
- countrycode : us
- cityid : 1
- cityname : town
- zipcode : 123456
- address : address
طلب:
https://www.afilnet.com/api/http/?class=subaccount&method=addsubaccount&user=user&password=password&accountemail=email@email.com&accountpassword=password&namelastname=name+lastname&iscompany=1&companyname=mycompany&documentid=123456789A&language=en&countrycode=us&cityid=1&cityname=town&zipcode=123456&address=address