Obtener eventos del grupo con C Sharp
Obtiene el listado de eventos de un grupo con C Sharp
C Sharp : DOCUMENTACIÓN API
- Crear grupo con C Sharp
- Obtener campos de un grupo con C Sharp
- Añadir campo a un grupo con C Sharp
- Elimina campo de un grupo con C Sharp
- Eliminar un grupo de contactos
- Asigna país a un grupo con C Sharp
- Obtener contactos del grupo con C Sharp
- Añadir contacto a grupo con C Sharp
- Modificar contacto del grupo con C Sharp
- Eliminar contacto del grupo con C Sharp
- Obtener listado de canales de chat activos con C Sharp
- Enviar un mensaje por chat con C Sharp
- Enviar un archivo por chat con C Sharp
- Obtener listado de conversaciones de un chat con C Sharp
- Obtener listado de mensajes de un chat con C Sharp
- Obtener listado de mensajes no leídos de un chat con C Sharp
Obtener eventos del grupo con C Sharp
String afilnet_class="event";
String afilnet_method="getevents";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="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);
// 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"] = "event";
data["method"] = "getevents";
data["user"] = "user";
data["password"] = "password";
data["idgroup"] = "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"] = "event";
data["method"] = "getevents";
data["idgroup"] = "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="event";
String afilnet_method="getevents";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_idgroup="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+"\"}");
Parámetro | Descripción | Obligatorio / Opcional |
---|---|---|
class=event | Clase a la que se realiza la petición | Obligatorio |
method=getevents | Método de la clase al que se realiza la petición | Obligatorio |
user | El usuario / email de su cuenta de Afilnet | Obligatorio |
password | El password de su cuenta de Afilnet | Obligatorio |
idgroup | Identificador del grupo | Obligatorio |
Al realizar peticiones recibirá los siguientes campos:
- status
-
result (si status=success), recibirá los siguientes valores:
- No recibirá valores adicionales
- error (si status=error), aquí recibirá el código de error
Los códigos de error posibles son los siguientes:
Código | Descripción |
---|---|
MISSING_USER | Usuario / email no incluido |
MISSING_PASSWORD | Password no incluido |
MISSING_CLASS | Clase no incluida |
MISSING_METHOD | Método no incluido |
MISSING_COMPULSORY_PARAM | Parámetro obligatorio no incluido |
INCORRECT_USER_PASSWORD | Usuario o clave incorrectos |
INCORRECT_CLASS | Clase incorrecta |
INCORRECT_METHOD | Método incorrecto |
NOT_ACCESS_TO_GROUP | No dispone de permisos al grupo indicado |
Parámetros:
- class : event
- method : getevents
- user : user
- password : password
- idgroup : 1000
Petición:
https://www.afilnet.com/api/http/?class=event&method=getevents&user=user&password=password&idgroup=1000