Envia Mensaje por Llamada con Codigo de Verificación 2FA
URL:https://www.onurix.com/api/v1/call/2fa/send
URL:https://www.onurix.com/api/v1/2fa/send-call
Parametros.
Nombre | Tipo | Requerido | Descripción |
---|---|---|---|
client | integer(int64) | true | El Id del cliente |
key | string | true | Key de la cuenta onurix |
phone | string | true | Numero de telefono . Ej “573150123456” |
app-name | string | true | Nombre de la app que va a ser usada para generar el codigo |
retries | string | false | Numero de intentos de la llamada, maximo 3 |
Respuesta.
Estado | Significado | Descripción | Esquema |
---|---|---|---|
200 | OK | Operación exitosa | JsonResponse |
400 | Client Error | Parametros invalidos | JsonResponse |
520 | Unknown | Error interno del sistema | ErrorResponse |
Code request
curl -X POST "https://www.onurix.com/api/v1/call/2fa/send" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d retries="AQUI_NUMERO_DE_INTENTOS" -d voice="AQUI_TIPO_DE_VOZ" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d app-name="AQUI_NOMBRE_APP" -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: application/json'
Code request
<?php
// Ejecutar: composer require guzzlehttp/guzzle:*
require'vendor/autoload.php';
$headers=array(
'Content-Type'=>'application/x-www-form-urlencoded',
'Accept'=>'application/json',
);
$client= new \GuzzleHttp\Client();
// Define la matriz del cuerpo de la solicitud.
$request_body = array(
"client"=>"AQUI_SU_CLIENT",
"key"=>"AQUI_SU_KEY",
"phone"=>"AQUI_EL_NUMERO_DE_CELULAR",
"app-name"=>"AQUI_NOMBRE_APP",
"retries"=>"AQUI_NUMERO_DE_INTENTOS",
);
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/call/2fa/send',array(
'headers'=>$headers,
'form_params'=>$request_body,
)
);
print_r($response->getBody()->getContents());
}
catch(\GuzzleHttp\Exception\BadResponseException $e){
// Manejar excepciones o errores de API
print_r($e->getMessage());
}
Code request
import requests
headers ={
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json'
}
data = {
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'app-name':'AQUI_NOMBRE_APP',
'retries':'AQUI_NUMERO_DE_INTENTOS',#OPCIONAL - POR DEFECTO 1
'phone':'AQUI_EL_NUMERO_DE_CELULAR'
}
r = requests.post('https://www.onurix.com/api/v1/call/2fa/send', headers = headers, data = data)
print(r.json())
Code request
//Este codigo fue hecho en .net 6
using System.Net.Http;
namespace PruebaOnurix
{
public class Program
{
public static void Main(string[] args)
{
Dictionary<string, string> parameters = new()
{
{ "client", "AQUI_SU_CLIENT"},
{ "key", "AQUI_SU_KEY"},
{ "phone", "AQUI_EL_NUMERO_DE_CELULAR"},
{ "app-name", "AQUI_NOMBRE_APP"},
{ "retries", "AQUI_NUMERO_DE_INTENTOS"},
};
SendCall2FA(parameters);
}
public static void SendCall2FA(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("/api/v1/call/2fa/send-call", new FormUrlEncodedContent(parameters)).Result;
string responseString = request.Content.ReadAsStringAsync().Result;
Console.WriteLine(responseString);
}
}
}
Code request
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/x-www-form-urlencoded"},
"Accept": []string{"application/json"},
}
data := strings.NewReader("client=AQUI_SU_CLIENT&key=AQUI_SU_KEY&phone=AQUI_EL_NUMERO_DE_CELULAR&app-name=AQUI_NOMBRE_APP&retries=AQUI_NUMERO_DE_INTENTOS")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/call/2fa/send", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Code request
// Ejecutar: npm install axios --save
const axios = require('axios').default;
let headers={
headers:{
'content-type': 'application/x-www-form-urlencoded',
}
}
let data ={
'client':'AQUI_SU_CLIENT',
'key':'AQUI_SU_KEY',
'phone':'AQUI_EL_NUMERO_DE_CELULAR',
'app-name':'AQUI_NOMBRE_APP',
'retries':'AQUI_NUMERO_DE_INTENTOS'
}
axios.post('https://www.onurix.com/api/v1/block-phone',data,headers)
.then(resp=>{
console.log(resp.data);
}).catch(error=>{
console.log(error);
});
Code request
//Para este codigo se uso jdk 11
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class SendCall2FA {
public static void main(String[] args) throws IOException, InterruptedException {
// TODO Auto-generated method stub
Map<String,String> parameters = new HashMap<>();
parameters.put("client", "AQUI_SU_CLIENT");
parameters.put("key", "AQUI_SU_KEY");
parameters.put("phone", "AQUI_EL_NUMERO_DE_CELULAR");
parameters.put("app-name", "AQUI_NOMBRE_APP");
parameters.put("retries", "AQUI_NUMERO_DE_INTENTOS");
var httpClient = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.version(HttpClient.Version.HTTP_2)
.POST(ofFormData(parameters))
.uri(URI.create("https://www.onurix.com/api/v1/call/2fa/send"))
.header("Content-Type", "application/x-www-form-urlencoded")
.build();
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
//System.out.println(response.body());
}
public static HttpRequest.BodyPublisher ofFormData(Map<String, String> parameters) {
var builder = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
if (builder.length() > 0) {
builder.append("&");
}
builder.append(URLEncoder.encode(entry.getKey().toString(), StandardCharsets.UTF_8));
builder.append("=");
builder.append(URLEncoder.encode(entry.getValue().toString(), StandardCharsets.UTF_8));
}
return HttpRequest.BodyPublishers.ofString(builder.toString());
}
}
Body parameters
client: 0,
key: "string",
app-name: "string",
retries: "string",
phone: "string"
Respuesta de ejemplo
Response 200
{
"status": "string",
"id": "string",
"minutes_to_expire": 0,
"data": [
{
"id": "string",
"state": "string",
"credits": 0,
"phone": 0,
"voice": "string"
}
]
}
Si requiere asistencia o tiene un problema, envienos un mensaje para poder ayudarlo
soporte@onurix.com