使用C sharp从群组中删除联系人
使用C sharp删除群组的联系人
C sharp : API文档
使用C sharp从群组中删除联系人
String afilnet_class="group";
String afilnet_method="deletecontact";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="1000";
String afilnet_idcontact="1000";
// 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+"&idgroup="+afilnet_idgroup+"&idcontact="+afilnet_idcontact);
// 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"] = "group";
data["method"] = "deletecontact";
data["user"] = "user";
data["password"] = "password";
data["idgroup"] = "1000";
data["idcontact"] = "1000";
// 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"] = "group";
data["method"] = "deletecontact";
data["idgroup"] = "1000";
data["idcontact"] = "1000";
// 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="group";
String afilnet_method="deletecontact";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="1000";
String afilnet_idcontact="1000";
// 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, "{\"idgroup\":\""+afilnet_idgroup+"\",\"idcontact\":\""+afilnet_idcontact+"\"}");
参数 | 描述 | 必修/可选 |
---|---|---|
class=group | 要求的课程:要求的课程 | 必修 |
method=deletecontact | 请求的类方法:发出请求的类的方法 | 必修 |
user | 您的Afilnet帐户的用户和电子邮件 | 必修 |
password | 您的Afilnet帐户的密码 | 必修 |
idgroup | 组号 | 必修 |
idcontact | 联络人编号 | 必修 |
发出请求时,您将收到以下字段:
- status
-
结果(如果status = success),您将在此处收到以下值:
- 没有其他值会发送给您
- 错误(如果status = error),在这里您将收到错误代码
下面列出了可能的错误代码
码 | 描述 |
---|---|
MISSING_USER | 不包括用户或电子邮件 |
MISSING_PASSWORD | 不包含密码 |
MISSING_CLASS | 不包括课程 |
MISSING_METHOD | 不包括方法 |
MISSING_COMPULSORY_PARAM | 不包括强制参数 |
INCORRECT_USER_PASSWORD | 用户或密码错误 |
INCORRECT_CLASS | 班级不正确 |
INCORRECT_METHOD | 方法不正确 |
NOT_ACCESS_TO_GROUP | 不允许您进入指定的组 |
参数:
- class : group
- method : deletecontact
- user : user
- password : password
- idgroup : 1000
- idcontact : 1000
请求:
https://www.afilnet.com/api/http/?class=group&method=deletecontact&user=user&password=password&idgroup=1000&idcontact=1000