HLR HTTP con C Sharp
Obtiene el estado de un número de teléfono o móvil 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
HLR HTTP con C Sharp
String afilnet_class="hlr";
String afilnet_method="checkphonenumbers";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_numbers="100000000,100000001,100000002";
// 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+"&numbers="+afilnet_numbers);
// 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"] = "hlr";
data["method"] = "checkphonenumbers";
data["user"] = "user";
data["password"] = "password";
data["numbers"] = "100000000,100000001,100000002";
// 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"] = "hlr";
data["method"] = "checkphonenumbers";
data["numbers"] = "100000000,100000001,100000002";
// 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="hlr";
String afilnet_method="checkphonenumbers";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_numbers="100000000,100000001,100000002";
// 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, "{\"numbers\":\""+afilnet_numbers+"\"}");
Parámetro | Descripción | Obligatorio / Opcional |
---|---|---|
class=hlr | Clase a la que se realiza la petición | Obligatorio |
method=checkphonenumbers | 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 |
numbers | Listado de números de teléfono incluyendo prefijo del país separados por , (comas) | Obligatorio |
Al realizar peticiones recibirá los siguientes campos:
- status
-
result (si status=success), recibirá los siguientes valores:
- credits
-
list
- number
- mccmnc
- imsi
- onname
- onprefix
- oncountry
- ported
- portedcountry
- portedname
- portedprefix
- error
- permanent_error
- 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 |
Parámetros:
- class : hlr
- method : checkphonenumbers
- user : user
- password : password
- numbers : 100000000,100000001,100000002
Petición:
https://www.afilnet.com/api/http/?class=hlr&method=checkphonenumbers&user=user&password=password&numbers=100000000,100000001,100000002