# Flash Call Verify API

DecisionTelecom Flash Call Verify API le permite enviar verificaciones de llamadas flash a cualquier país del mundo a través de la API. El número de teléfono desde el cual se realizará la llamada entrante, contendrá el código requerido para la verificación, en los últimos 4-6 dígitos.

Cada llamada se identifica mediante una identificación aleatoria única.

La API Flash Call Verify utiliza HTTPS con clave de acceso que se utiliza como autorización de la API. Las cargas útiles de solicitud y respuesta se formatean como JSON con codificación UTF-8 y valores codificados en URL.

**Autorización API:** clave de acceso Base64.

Póngase en contacto con su administrador de cuenta para obtener una clave API.

## Send Flash Call Verification

Auth: Basic Auth (api key)

{% tabs %}
{% tab title="Method Post " %}

```
https://web.it-decision.com/v1/api/flash-call
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Params json:" %}

```json
{
   "phone":380631111111,
   "sender":"Decision",
   "text":1233,
   "validity_period":2
}
```

{% endtab %}
{% endtabs %}

**phone** <mark style="color:red;">int</mark> The telephone number that you want to do a network query on

**sender** <mark style="color:red;">string</mark>  The sender of the message. This can be a mobile phone number (including a country code) or an alphanumeric string. The maximum length of alphanumeric strings is 11 characters.

&#x20;**validity\_period** <mark style="color:red;">int</mark> SMS lifetime  min 2 minute max 4320

**Text** <mark style="color:red;">string</mark> Text consists only short code with 4-6 numbers

**Response:**\
Returns json string if the request was successful.

```json
{
   "id": 26381905,
   "phone": 380631111111,
   "status": "Accepted"
}
```

**Id** <mark style="color:red;">int</mark> - A unique random ID which is created on the DecisionTelecom platform.

**status** <mark style="color:red;">string</mark> – the status of the phone. Possible values: accepted, rejected, unknown, and failed

## &#x20;Example code :

{% tabs %}
{% tab title="CURL" %}

```
curl --location 'https//:web.it-decision.com/v1/api/flash-call' \
--header 'Authorization: Basic api key' \
--header 'Content-Type: application/json' \
--data '{"phone":380631111111,"sender":"Decision","text":1233,"validity_period":2}'
```

{% endtab %}

{% tab title="GO" %}

```
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https//:web.it-decision.com/v1/api/flash-call"
  method := "POST"

  payload := strings.NewReader(`{"phone":380631111111,"sender":"Decision","text":1233,"validity_period":2}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Basic api key")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="C# " %}

```
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https//:web.it-decision.com/v1/api/flash-call");
request.Headers.Add("Authorization", "Basic api key");
var content = new StringContent("{\"phone\":380631111111,\"sender\":\"Decision\",\"text\":1233,\"validity_period\":2}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

{% endtab %}

{% tab title="Java" %}

```
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"phone\":380631111111,\"sender\":\"Decision\",\"text\":1233,\"validity_period\":2}");
Request request = new Request.Builder()
  .url("https//:web.it-decision.com/v1/api/flash-call")
  .method("POST", body)
  .addHeader("Authorization", "Basic api key")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();
```

{% endtab %}

{% tab title="C – libcurl" %}

```
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
  curl_easy_setopt(curl, CURLOPT_URL, "https//:web.it-decision.com/v1/api/flash-call");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "Authorization: Basic api key");
  headers = curl_slist_append(headers, "Content-Type: application/json");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  const char *data = "{\"phone\":380631111111,\"sender\":\"Decision\",\"text\":1233,\"validity_period\":2}";
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
  res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
```

{% endtab %}

{% tab title="PHP" %}

```
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https//:web.it-decision.com/v1/api/flash-call',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{"phone":380631111111,"sender":"Decision","text":1233,"validity_period":2}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic api key',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}

{% tab title="Python" %}

```
import http.client
import json

conn = http.client.HTTPSConnection("https")
payload = json.dumps({
  "phone": 380631111111,
  "sender": "Decision",
  "text": 1233,
  "validity_period": 2
})
headers = {
  'Authorization': 'Basic api key',
  'Content-Type': 'application/json'
}
conn.request("POST", "//:web.it-decision.com/v1/api/flash-call", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}
{% endtabs %}
