Code request
# También puede usar wget
curl -X POST "https://www.onurix.com/api/v1/call/send" -d key="AQUI_SU_KEY" -d client="AQUI_SU_CLIENT" -d phone="AQUI_EL_NUMERO_DE_CELULAR" -d message="AQUI_EL_MENSAJE_A_ENVIAR" -d voice="AQUI_TIPO_DE_VOZ" -d retries="AQUI_NUMERO_DE_INTENTOS" -d group="AQUI_ID_DE_GRUPO" -d leave-voicemail="AQUI_CONFIRMACION_BUZON_DE_VOZ" -d audio-code="AQUI_ID_AUDIO" -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",
"message"=>"AQUI_EL_MENSAJE_A_ENVIAR",
"voice"=>"AQUI_TIPO_DE_VOZ",
"retries"=>"AQUI_NUMERO_DE_INTENTOS",
"leave-voicemail"=>"false",
"audio-code"=>"AQUI_ID_AUDIO",
);
try{
$response=$client->request('POST','https://www.onurix.com/api/v1/call/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',
'phone':'AQUI_EL_NUMERO_DE_CELULAR',#PARA ENVIAR MULTIPLES TELEFONOS TENDRAN QUE SER SEPARADOS POOR COMAS ","
'message':'AQUI_EL_MENSAJE_A_ENVIAR',#EN CASO DE ENVIAR PARAMETRO AUDIO-CODE NO PASAR PARAMETROS MESSAGE Y VOICE
'voice':'AQUI_TIPO_DE_VOZ',
'retries':'AQUI_NUMERO_DE_INTENTOS',#OPCIONAL POR DEFECTO 1
'leave-voicemail':'false',
#'audio-code':'AQUI_ID_AUDIO',
'groups': 'AQUI_ID_GRUPOS'#PARA ENVIAR MULTIPLES TELEFONOS TENDRAN QUE SER SEPARADOS POOR COMAS ","
}
r = requests.post('https://www.onurix.com/api/v1/call/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"},
{ "message", "AQUI_EL_MENSAJE_A_ENVIAR"},
{ "voice", "AQUI_TIPO_DE_VOZ" },
{ "retries", "AQUI_NUMERO_DE_INTENTOS"},
{ "leave-voicemail","AQUI_CONFIRMACION_BUZON_DE_VOZ"},
//{ "audio-code","AQUI_ID_AUDIO"},
{ "groups","AQUI_ID_GRUPO"}
};
SendCall(parameters);
}
public static void SendCall(Dictionary<string,string> parameters)
{
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://www.onurix.com"),
};
HttpResponseMessage request = httpClient.PostAsync("api/v1/call/send", 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&message=AQUI_EL_MENSAJE_A_ENVIAR&voice=AQUI_TIPO_DE_VOZ&retries=AQUI_NUMERO_DE_INTENTOS&leave-voicemail=false&audio-code=AQUI_AUDIO_CODE&groups=AQUI_ID_GRUPO")
req, err := http.NewRequest("POST", "https://www.onurix.com/api/v1/call/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',//PARA ENVIAR MULTIPLES TELEFONOS TENDRAN QUE SER SEPARADOS POOR COMAS ","
'message':'AQUI_EL_MENSAJE_A_ENVIAR',//EN CASO DE ENVIAR PARAMETRO AUDIO-CODE NO PASAR PARAMETROS MESSAGE Y VOICE
'voice':'AQUI_TIPO_DE_VOZ',
'retries':'AQUI_NUMERO_DE_INTENTOS',//OPCIONAL POR DEFECTO 1
'leave-voicemail':'false',
//'audio-code':'AQUI_ID_AUDIO',
'groups': 'AQUI_ID_GRUPOS'//PARA ENVIAR MULTIPLES TELEFONOS TENDRAN QUE SER SEPARADOS POOR COMAS ","
}
axios.post('https://www.onurix.com/api/v1/call/send',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 SendCall {
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");//PARA ENVIAR MULTIPLES TELEFONOS TENDRAN QUE SER SEPARADOS POR COMAS ","
parameters.put("message", "AQUI_EL_MENSAJE_A_ENVIAR");//EN CASO DE ENVIAR PARAMETRO AUDIO-CODE NO PASAR PARAMETROS MESSAGE Y VOICE
parameters.put("voice", "AQUI_TIPO_DE_VOZ");
parameters.put("retries", "AQUI_NUMERO_DE_INTENTOS");
parameters.put("leave-voicemail", "false");
//parameters.put("audio-code", "AQUI_ID_AUDIO");
parameters.put("groups","AQUI_ID_GRUPOS");
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/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",
phone: "string",
message: "string",
voice: "string",
retries: "string",
leave-voicemail: true,
audio-code: "string",
groups: "string"
Respuesta de ejemplo
Response 200
{
"status": "string",
"id": "string",
"data": [
{
"id": "string",
"state": "string",
"credits": 0,
"message": "string",
"phone": "string",
"voice": "string"
}
]
}