Code Examples

The following code blocks give examples of how to query number information on an MSISDN.

Example for Query GNP (synchronous response):

curl
    -u username:password
    -X GET
    -H "Accept: application/json"
    https://rest.tyntec.com/nis/v1/gnp?msisdn=+491622943176

 Example for Query GNP (asynchronous response):

curl
    -u username:password
    -X GET
    -H "Accept: application/json"
    https://rest.tyntec.com/nis/v1/gnp?msisdn=+491622943176&callbackUrl=https://rest.customer.com/inbound/

 Response to Query GNP containing the requested number information:

{
"requestId":"12-86cfafba-8677-f42b-5050-ece6af6abf01",
"msisdn":"+491622943176",
 "mcc":"262",
 "mnc":"02",
 "ttId":15,
"operator":" Vodafone",
 "country":"DEU",
 "timeZone":"+0100",
 "technology":"GSM",
 "ported":"false",
 "price":0.001,
 "currency":"EUR",
 "priceEffective":"2010-11-01T00:00:00+0000",
 "errorCode":"0"
}

 In this request, there are a number of parameters that need to be defined, while others are optional:

Parameter

Possible Values

Description

requestID

UUID according to RFC 4122

The unique identifier provided for each request.

msisdn

Phone number according to ITU E.164

The phone number of interest given in international format.

MCC

UTF-8 encoded string according to ITU E.212

A representative MCC (Mobile Country Code) of the operator.

MNC

UTF-8 encoded strong according to ITU E.212

A representative MNC (Mobile Network Code) of the operator.

ttId

integer

The respective tyntec ID of the network.

operator

string

The human readable name of the operator.

country

Country code following ISO 3166-1 alpha-3

The three-letter country code where the operator is located.

timeZone

+HH:mm (according to ISO 8601)

The operator’s local time zone relative to UTC.

technology

UTF-8 encoded string

Technology used by the operator’s network. Possible values are: GSM, MVNO GSM, GSM/CDMA, Satellite, CDMA, iDen, iDen/GSM, Pager, Fixed.

ported

boolean

An indication of the porting status (yes/no).

price

float

The price for the query.

currency

Currency code following ISO 4217

The currency in which the pricing is given; corresponding to the currency of the invoice.

priceEffective

Date in the format “yyyy-MM-ddTHH:mm:ss” (according to ISO 8601)

The date when “price” became effective.

errorCode

The reason for an unsuccessful attempts.

 Possible values for error codes are given in a following table.