Consultas de RUC y cédula de Identidad de Ecuador

Conoce mejor a tus clientes a través de un API

Servicio de validación de datos de personas naturales y empresas de Ecuador. Las consultas son realizadas en tiempo real en el instante en el que usted la solicita, obteniendo información completa y verificada.

API Cédula Ecuatoriana

Write the code

Add the following to send-sms.sh:

curl --location \
--request GET 'https://webservices.ec/api/cedula/{IDENTITY_ID}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {ACCESS_TOKEN}'
                                                            

Run your code

Save this file to your machine and run it:

sh send-sms.sh

Prerequisites

npm install @vonage/server-sdk

Create a file named send.js and add the following code:

const Vonage = require('@vonage/server-sdk')

const vonage = new Vonage({
  apiKey: VONAGE_API_KEY,
  apiSecret: VONAGE_API_SECRET
})
                                                                    

Write the code

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://webservices.ec/api/cedula/{IDENTITY_ID}',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: Bearer {ACCESS_TOKEN}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
?>
                                                            

Run your code

Save this file to your machine and run it:

node send.js

Prerequisites

Add the following to `build.gradle`:

compile 'com.vonage:client:6.2.0'

Create a class named SendMessage and add the following code to the main method:

Hello

Write the code

Add the following to the main method of the SendMessage class:

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://webservices.ec/api/cedula/{IDENTITY_ID}")
  .method("GET", null)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {ACCESS_TOKEN}")
  .build();
Response response = client.newCall(request).execute();

Run your code

We can use the application plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:

  apply plugin: 'application'
  mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''

Run the following gradle command to execute your application, replacing com.vonage.quickstart.sms with the package containing SendMessage:

gradle run -Pmain=com.vonage.quickstart.sms.SendMessage

Prerequisites

Install-Package Vonage

Create a file named SendSms.cs and add the following code:

using Vonage;
using Vonage.Request;
                                                                    

Add the following to SendSms.cs:

var credentials = Credentials.FromApiKeyAndSecret(
    VONAGE_API_KEY,
    VONAGE_API_SECRET
    );

var VonageClient = new VonageClient(credentials);
                                                                    

Write the code

Add the following to SendSms.cs:

var client = new RestClient("https://webservices.ec/api/cedula/{IDENTITY_ID}");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer {ACCESS_TOKEN}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Prerequisites

composer require vonage/client

Create a file named send-sms.php and add the following code:

$basic  = new \Vonage\Client\Credentials\Basic(VONAGE_API_KEY, VONAGE_API_SECRET);
$client = new \Vonage\Client($basic);
                                                                    

Write the code

Add the following to send-sms.php:

$response = $client->sms()->send(
    new \Vonage\SMS\Message\SMS(TO_NUMBER, BRAND_NAME, 'A text message sent using the Nexmo SMS API')
);

$message = $response->current();

if ($message->getStatus() == 0) {
    echo "The message was sent successfully\n";
} else {
    echo "The message failed with status: " . $message->getStatus() . "\n";
}
                                                            

Run your code

Save this file to your machine and run it:

php send-sms.php

Prerequisites

pip install vonage

Create a file named send-an-sms.py and add the following code:

client = vonage.Client(key=VONAGE_API_KEY, secret=VONAGE_API_SECRET)
sms = vonage.Sms(client)
                                                                    
Write the code

Add the following to2 send-an-sms.py:

responseData = sms.send_message(
    {
        "from": VONAGE_BRAND_NAME,
        "to": TO_NUMBER,
        "text": "A text message sent using the Nexmo SMS API",
    }
)

if responseData["messages"][0]["status"] == "0":
    print("Message sent successfully.")
else:
    print(f"Message failed with error: {responseData['messages'][0]['error-text']}")
                                                                
end python-->

Run your code

Save this file to your machine and run it:

python send-an-sms.py

Prerequisites

gem install vonage

Create a file named send.rb and add the following code:

client = Vonage::Client.new(
  api_key: VONAGE_API_KEY,
  api_secret: VONAGE_API_SECRET
)
                                                                    

Write the code

Add the following to send.rb:

client.sms.send(
  from: VONAGE_BRAND_NAME,
  to: TO_NUMBER,
  text: 'A text message sent using the Vonage SMS API'
)
                                                            

Run your code

Save this file to your machine and run it:

ruby send.rb

API RUC Ecuador

Prerequisites

Execute the following command at your terminal prompt to create the JWT for authentication:

export JWT=$(nexmo jwt:generate $PATH_TO_PRIVATE_KEY application_id=$NEXMO_APPLICATION_ID)

Write the code

Add the following to make-an-outbound-call.sh:

curl --location \
--request GET 'https://webservices.ec/api/ruc/{IDENTITY_ID}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {ACCESS_TOKEN}'


                                                            

Run your code

Save this file to your machine and run it:

bash make-an-outbound-call.sh

Prerequisites

npm install @vonage/server-sdk

Create a file named make-call.js and add the following code:

const Vonage = require('@vonage/server-sdk')

const vonage = new Vonage({
  apiKey: VONAGE_API_KEY,
  apiSecret: VONAGE_API_SECRET,
  applicationId: VONAGE_APPLICATION_ID,
  privateKey: VONAGE_APPLICATION_PRIVATE_KEY_PATH
})
                                                                    

Write the code

Add the following to make-call.js:

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://webservices.ec/api/ruc/{IDENTITY_ID}',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: Bearer {ACCESS_TOKEN}'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
?>

Run your code

Save this file to your machine and run it:

node make-call.js

Prerequisites

Add the following to `build.gradle`:

compile 'com.vonage:client:6.2.0'

Create a class named OutboundTextToSpeech and add the following code to the main method:

VonageClient client = VonageClient.builder()
        .applicationId(VONAGE_APPLICATION_ID)
        .privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
        .build();
                                                                    

Write the code

Add the following to the main method of the OutboundTextToSpeech class:

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://webservices.ec/api/ruc/{IDENTITY_ID}")
  .method("GET", null)
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer {ACCESS_TOKEN}")
  .build();
Response response = client.newCall(request).execute();

Run your code

We can use the application plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:

  apply plugin: 'application'
  mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''

Run the following gradle command to execute your application, replacing com.vonage.quickstart.voice with the package containing OutboundTextToSpeech:

gradle run -Pmain=com.vonage.quickstart.voice.OutboundTextToSpeech

Prerequisites

Install-Package Vonage

Create a file named MakeOutboundCall.cs and add the following code:

using Vonage;
using Vonage.Request;
using Vonage.Voice;
using Vonage.Voice.Nccos.Endpoints;
                                                                    

Add the following to MakeOutboundCall.cs:

var creds = Credentials.FromAppIdAndPrivateKeyPath(VONAGE_APPLICATION_ID, VONAGE_PRIVATE_KEY_PATH);
var client = new VonageClient(creds);
                                                                    

Write the code

Add the following to MakeOutboundCall.cs:

var client = new RestClient("https://webservices.ec/api/ruc/{IDENTITY_ID}");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer {ACCESS_TOKEN}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Prerequisites

composer require vonage/client

Create a file named text-to-speech-outbound.php and add the following code:

$keypair = new \Vonage\Client\Credentials\Keypair(
    file_get_contents(VONAGE_APPLICATION_PRIVATE_KEY_PATH),
    VONAGE_APPLICATION_ID
);

$client = new \Vonage\Client($keypair);
                                                                    

Write the code

Add the following to text-to-speech-outbound.php:

$outboundCall = new \Vonage\Voice\OutboundCall(
    new \Vonage\Voice\Endpoint\Phone(TO_NUMBER),
    new \Vonage\Voice\Endpoint\Phone(VONAGE_NUMBER)
);
$outboundCall->setAnswerWebhook(
    new \Vonage\Voice\Webhook(
        'https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/text-to-speech.json',
        \Vonage\Voice\Webhook::METHOD_GET
    )
);
$response = $client->voice()->createOutboundCall($outboundCall);

var_dump($response);
                                                            

Run your code

Save this file to your machine and run it:

php text-to-speech-outbound.php

Prerequisites

pip install vonage

Create a file named make-an-outbound-call.py and add the following code:

client = vonage.Client(
    application_id=VONAGE_APPLICATION_ID,
    private_key=VONAGE_APPLICATION_PRIVATE_KEY_PATH,
)
                                                                    

Write the code

Add the following to make-an-outbound-call.py:

voice = vonage.Voice(client)

response = voice.create_call({
  'to': [{'type': 'phone', 'number': TO_NUMBER}],
  'from': {'type': 'phone', 'number': VONAGE_NUMBER},
  'answer_url': ['https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/text-to-speech.json']
})

pprint(response)

Run your code

Save this file to your machine and run it:

python3 make-an-outbound-call.py

Prerequisites

gem install vonage

Create a file named outbound_tts_call.rb and add the following code:

client = Vonage::Client.new(
  api_key: VONAGE_API_KEY,
  api_secret: VONAGE_API_SECRET,
  application_id: VONAGE_APPLICATION_ID,
  private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH)
)
                                                                    

Write the code

Add the following to outbound_tts_call.rb:

response = client.voice.create(
  to: [{
    type: 'phone',
    number: TO_NUMBER
  }],
  from: {
    type: 'phone',
    number: VONAGE_NUMBER
  },
  answer_url: [
    'https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/text-to-speech.json'
  ]
)

puts response.inspect

Run your code

Save this file to your machine and run it:

ruby outbound_tts_call.rb





DotNet
NETCore
Java
Php
Python
Perl