إرسال ملف عن طريق WhatsAPP مع C Sharp
whatsapp.sendfile.desc.language
C Sharp : وثائق API
- إنشاء مجموعة باستخدام C Sharp
- الحصول على قائمة حقول المجموعة باستخدام C Sharp
- إضافة حقل إلى مجموعة بها C Sharp
- حذف حقل من مجموعة بها C Sharp
- حذف جهة اتصال من مجموعة
- عيّن البلد إلى مجموعة بها C Sharp
- الحصول على قائمة جهات اتصال المجموعة باستخدام C Sharp
- إضافة جهة اتصال إلى مجموعة بها C Sharp
- تعديل جهة اتصال مجموعة بها C Sharp
- حذف جهة اتصال لمجموعة بها C Sharp
إرسال ملف عن طريق WhatsAPP مع C Sharp
String afilnet_class="whatsapp";
String afilnet_method="sendfile";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platformid="100";
String afilnet_destination="3460000000";
String afilnet_type="image";
String afilnet_fileurl="https://www.example.com/image.jpg";
String afilnet_thumburl="https://www.example.com/thumb.jpg";
String afilnet_message="test+message";
// Create an URL request
WebRequest request = WebRequest.Create("https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&platformid="+afilnet_platformid+"&destination="+afilnet_destination+"&type="+afilnet_type+"&fileurl="+afilnet_fileurl+"&thumburl="+afilnet_thumburl+"&message="+afilnet_message);
// Get the response
WebResponse response = request.GetResponse ();
// Get the stream returned by the server
Stream dataStream = response.GetResponseStream();
// Open the stream
StreamReader reader = new StreamReader (dataStream);
// Read the Response
String result = reader.ReadToEnd ();
// Asign vars
var data = new NameValueCollection();
data["class"] = "whatsapp";
data["method"] = "sendfile";
data["user"] = "user";
data["password"] = "password";
data["platformid"] = "100";
data["destination"] = "3460000000";
data["type"] = "image";
data["fileurl"] = "https://www.example.com/image.jpg";
data["thumburl"] = "https://www.example.com/thumb.jpg";
data["message"] = "test+message";
// Create Web client
var wb = new WebClient();
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/http/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
// Asign vars
var data = new NameValueCollection();
data["class"] = "whatsapp";
data["method"] = "sendfile";
data["platformid"] = "100";
data["destination"] = "3460000000";
data["type"] = "image";
data["fileurl"] = "https://www.example.com/image.jpg";
data["thumburl"] = "https://www.example.com/thumb.jpg";
data["message"] = "test+message";
// Create Web client
var wb = new WebClient { Credentials = new NetworkCredential("user", "password") };
// Execute POST petition
var response = wb.UploadValues("https://www.afilnet.com/api/http/", "POST", data);
// Get response
string responseString = Encoding.UTF8.GetString(response);
String afilnet_class="whatsapp";
String afilnet_method="sendfile";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_platformid="100";
String afilnet_destination="3460000000";
String afilnet_type="image";
String afilnet_fileurl="https://www.example.com/image.jpg";
String afilnet_thumburl="https://www.example.com/thumb.jpg";
String afilnet_message="test+message";
// Allow SSL/TLS config
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// We create the webservice instance (Register Web Service first in project)
var service = new WebService.ApplicationServicesPortTypeClient();
// Call to WebService method
String response = service.call(afilnet_user, afilnet_password, afilnet_class, afilnet_method, "{\"platformid\":\""+afilnet_platformid+"\",\"destination\":\""+afilnet_destination+"\",\"type\":\""+afilnet_type+"\",\"fileurl\":\""+afilnet_fileurl+"\",\"thumburl\":\""+afilnet_thumburl+"\",\"message\":\""+afilnet_message+"\"}");
معامل | وصف | إجباري / اختياري |
---|---|---|
class=whatsapp | الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها | إلزامي |
method=sendfile | طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه | إلزامي |
user | المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك | إلزامي |
password | كلمة المرور لحساب Afilnet الخاص بك | إلزامي |
platformid | معرّف النظام الأساسي | إلزامي |
destination | whatsapp.sendfile_destination | إلزامي |
type | whatsapp.sendfile_type | إلزامي |
fileurl | whatsapp.sendfile_fileurl | إلزامي |
thumburl | whatsapp.sendfile_thumburl | اختياري |
message | whatsapp.sendfile_message | اختياري |
عند تقديم طلبات ، ستتلقى الحقول التالية:
- status
-
النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
- لن يتم إرسال قيم إضافية إليك
- خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ
يتم سرد رموز الأخطاء المحتملة أدناه
الشفرة | وصف |
---|---|
MISSING_USER | المستخدم أو البريد الإلكتروني غير المدرجة |
MISSING_PASSWORD | كلمة المرور غير المدرجة |
MISSING_CLASS | الطبقة غير المدرجة |
MISSING_METHOD | طريقة غير المدرجة |
MISSING_COMPULSORY_PARAM | المعلمة الإجبارية غير المدرجة |
INCORRECT_USER_PASSWORD | مستخدم غير صحيح أو كلمة المرور |
INCORRECT_CLASS | فئة غير صحيحة |
INCORRECT_METHOD | طريقة غير صحيحة |
CHANNEL_NOT_FOUND | القناة المشار إليها غير موجودة |
CHAT_NOT_FOUND | الدردشة المشار إليها غير موجودة |
INCORRECT_FILETYPE | نوع الملف خاطئ ، تحقق من القيم الممكنة |
INCORRECT_FILEURL | عنوان url للملف غير صالح |
INCORRECT_THUMBURL | عنوان url للصورة المصغرة غير صالح |
المعلمات:
- class : whatsapp
- method : sendfile
- user : user
- password : password
- platformid : 100
- destination : 3460000000
- type : image
- fileurl : https://www.example.com/image.jpg
- thumburl : https://www.example.com/thumb.jpg
- message : test+message
طلب:
https://www.afilnet.com/api/http/?class=whatsapp&method=sendfile&user=user&password=password&platformid=100&destination=3460000000&type=image&fileurl=https://www.example.com/image.jpg&thumburl=https://www.example.com/thumb.jpg&message=test+message