DecisionTelecom позволяет отправлять сетевые запросы на любой мобильный номер по всему миру. Это позволяет вам просматривать, какой номер мобильного телефона принадлежит какому оператору в режиме реального времени и видеть, активен ли номер.
HLR API использует HTTPS с ключом доступа, который используется в качестве авторизации API. Полезные данные запросов и ответов форматируются как JSON с использованием кодировки UTF-8 и значений в кодировке URL.
API Авторизация - Базовый ключ доступа Base64.
Чтобы получить ключ API, пожалуйста, свяжитесь с вашим менеджером по работе с клиентами.
Отправить HLR
POST
Copy https://web.it-decision.com/v1/api/hlr
Request JSON:
Copy {
"phones" : [ 380636151111 , 380631111112 ]
}
Параметры:
Phones : array - Список номеров телефонов, по которым вы хотите выполнить сетевой запрос. – Обязательный.
Response:
Возвращает JSON string если запрос был успешным.
Copy [
{
"id" : 2345234 ,
"phone" : 380631111111 ,
"href" : "https://web.it-decision.com/v1/api/hlr-status?id=380631111111" ,
"status" : "Accepted"
} ,
{
"id" : 2345235 ,
"phone" : 380631111112 ,
"href" : "https://web.it-decision.com/v1/api/hlr-status?id=380631111112" ,
"status" : "Accepted"
}
]
Параметры:
Id int - Уникальный случайный идентификатор, созданный на платформе DecisionTelecom. Обязательный.
status string – состояние телефона.
Возможные значения: accepted, sent, absent, active, unknown, and failed.
Статус HLR
Пример запроса:
GET
Copy https://web.it-decision.com/v1/api/hlr-status?id=2345234
Пример ответа JSON:
Copy {
"id" : 2345234 ,
"phone" : 38063122121 ,
"mcc" : "255" ,
"mnc" : "06" ,
"network" : "Lifecell" ,
"ported" : false ,
"status" : 0 ,
"error" : 0 ,
"type" : "mobile" ,
"present" : "yes" ,
"status_message" : "Success"
}
Значения
ID : a unique random ID which is created on the DecisionTelecom
Phone : int The telephone number.
MCC : the Mobile Country Code of the current carrier.
MNC : the Mobile Network Code of the current carrier.
Network : the name of the current carrier.
Ported : boolean, true / false / null.
Type : text label: mobile / fixed.
Present : yes/ no / na (not available) – whether the subscriber is present in the network.
Status_message : text, the description of the above ‘status’: Success / Invalid Number / Not allowed country.
Status : number, a code for the outcome of the query:
0 = success
1 = invalid Number
2 = not allowed country
HTTP Unsuccessful Response format , If the status is not 0 (Success), only the number, status and status_message will be returned.
Example Response : { "status_message" : "Invalid Number", "status" : 1 }
Errors :
0-No error.
1-Unknown subscriber: The number is not allocated.
2-The owning network cannot be reached.
3-The network cannot reach the number.
4-The location of the number is not known to the network.
5-The number, as published in HLR, in not known to the MSC.
6-The number is absent for SM.
7-Unknown equipment.
8-Roaming not allowed.
9-Illegal subscriber.
10-Bearer service not provisioned.
11-Tele-service not provisioned.
12-Illegal equipment.
13-Call barred.
21-Facility not supported.
27-Phone switched off.
28-Incompatible terminal.
31-The subscriber is busy.
32-The delivery of the SM has failed.
33-A congestion (a full waiting list) occurred.
34-System failure.
35-Missing data.
36-Data error.
191-Unsupported network for which offers portability status.
192-Unsupported network for which offers the Origin Network.
193-Landline Fixed network (not covered).
Примеры HLR
cURL PHP GOLANG JAVA C# C - libcurl NodeJS Python Ruby
Copy curl --location --request POST 'https://web.it-decision.com/v1/api/hlr' \
--header 'Authorization: Basic api key' \
--header 'Content-Type: application/json' \
--data-raw '{"phones":[380636151111,380631111112]}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://web.it-decision.com/v1/api/hlr',
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 =>'{"phones":[380636151111,380631111112]}',
CURLOPT_HTTPHEADER => array(
'Authorization: Basic api key',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Copy package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://web.it-decision.com/v1/api/hlr"
method := "POST"
payload := strings.NewReader(`{"phones":[380636151111,380631111112]}`)
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))
}
Copy OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"phones\":[380636151111,380631111112]}");
Request request = new Request.Builder()
.url("https://web.it-decision.com/v1/api/hlr")
.method("POST", body)
.addHeader("Authorization", "Basic api key")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Copy var client = new RestClient("https://web.it-decision.com/v1/api/hlr");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic api key");
request.AddHeader("Content-Type", "application/json");
var body = @"{""phones"":[380636151111,380631111112]}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Copy 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/hlr");
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 = "{\"phones\":[380636151111,380631111112]}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
Copy ar https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'web.it-decision.com',
'path': '/v1/api/hlr',
'headers': {
'Authorization': 'Basic api key',
'Content-Type': 'application/json'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"phones": [
380636151111,
380631111112
]
});
req.write(postData);
req.end();
Copy import http.client
import json
conn = http.client.HTTPSConnection("web.it-decision.com")
payload = json.dumps({
"phones": [
380636151111,
380631111112
]
})
headers = {
'Authorization': 'Basic api key',
'Content-Type': 'application/json'
}
conn.request("POST", "/v1/api/hlr", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Copy require "uri"
require "json"
require "net/http"
url = URI("https://web.it-decision.com/v1/api/hlr")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Basic api key"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"phones": [
380636151111,
380631111112
]
})
response = https.request(request)
puts response.read_body