Skip to the content

FormatTelephoneNumber

Converts a telephone number to its standard format

Live Demo

To connect to this service you'll need to use one of these endpoints:

WSDL
https://webservices.data-8.co.uk/telephoneformatting.asmx
JSON
https://webservices.data-8.co.uk/TelephoneFormatting/FormatTelephoneNumber.json

Description

The service returns the telephone number formatted according to a number of options as described below. The default combination of these options means that input telephone numbers are treated as UK unless they include a country code, and UK numbers are formatted using national dialling rules (e.g. 0151 355 4555) while all other countries are formatted using international dialling rules (e.g. +1 800 555 1234).

Parameters

The following parameters can be supplied to this method

username

username

See the available authentication methods. If you are using username & password authentication, specify the username to authenticate as. If you are using API Key authentication and you are not using the JSON, Javascript or ADO APIs, use your API Key here with the prefix apikey-, e.g. apikey-ABCD-1234-EFGH-5678
password

password

If you are using username & password authentication, specify the password to use for authentication. Otherwise leave this blank.
number

number

The telephone number to reformat

options

options

An array of options that control further details of how this method operates. See the Advanced Options section below for more information.

Advanced Options

The following options can be specified as part of the option parameter. Each option is specified as a key/value pair. The list of available names is shown below, along with a description of the allowable values for that name.

DefaultCountryCode

DefaultCountryCode

The country code (without leading + or 00) that telephone numbers are assumed to be from if no country code is included in the input telephone number.

DefaultFormatType

DefaultFormatType

The format the telephone number should be returned in. This can be one of the following values:

  • International - the number is presented back with full international dialling code
  • National - the number is presented back without the international dialling code but with the full area code
  • Local - the number is presented back with only the local part
DifferentFormatCountries

DifferentFormatCountries

A comma-separated list of country codes (without leading + or 00). Any telephone numbers for these countries will be formatted using the DifferentFormatType format instead of the DefaultFormatType.

DifferentFormatType

DifferentFormatType

The format the telephone number should be returned in if it is from a country listed in DifferentFormatCountries. This can be one of the same set of values as DefaultFormatType.

UseLocalFormatting

UseLocalFormatting

Indicates if telephone numbers should be formatted according to the country-specific rules for its particular country. If this is set to false, numbers are formatted according to ITU international standard formatting.

Results

This method returns an object containing the following fields:

Status

Status

Indicates whether the method call was successful, or if some error occurred. If the Success field is true, the other results described below can be used to get the results of the method. If Success is false, some error occurred in calling the method, such as the authentication failed or the account is out of credits. The details of the error can be obtained from the ErrorMessage field, and any other results should be ignored
FormattedNumber

FormattedNumber

Contains the formatted version of the supplied number

Live Demo

number
options
Name Value
Credits Remaining Today: 5

Sample Code

Start a Free 30 Day Trial Today

Start a free trial today