Get Carrier Lookup

Get the cellular carrier ID and Name for a specific phone number.

Overview

Get the cellular carrier ID and Name for a specific phone number.

Carrier Lookup Limit:

Carrier lookups can be done up to 10 parallel requests with 10 numbers in each request.

 

Syntax

C#

[OperationContractAttribute()]
SBT.API.DataContracts.Common.WSCarrierLookupResponse GetCarrierLookup(
    string securityToken,
    List<string> phone
    string orgCode
)

 

WSDL

Production: https://ui.solutionsbytext.com/Sbt.App.SetUp/WSServices/GeneralWSService.svc?singleWsdl

Staging: https://test.solutionsbytext.com/Sbt.App.SetUp/WSServices/GeneralWSService.svc?singleWsdl

 

 

Parameters

securityToken

– String[1000] (Required) – SecurityToken to authenticate the user

phone

– List<string> (Required) – List of phone numbers to be checked for Carrier Code (with country code).

orgCode

– String[20] (Required) – Organization Code for the group, division, organization or company.

Note: Upto 10 phone numbers can be looked for carriers in a single request.

Return Value

WSCarrierPhoneResponse
NameTypeDescription
ResultboolTrue/False whether the call was successful or not.
ErrorCodeintFor Success/Failure it returns an error number.
MessagestringMessage related to error code.
ResponseList<WSCarrierPhoneRow>List of carrier phone.
Carrier – Carrier Name of cellular phone number.
CarrierCode – Carrier Code of cellular phone number.
International – True-It is an international number, False = It is not international.
Invalid – True = It is an Invalid number, False = It is valid. 
Landline – True = It is a Landline number, False = It is not Landline number.
Phone – The phone number that was checked.

 

Developer Tips

The GetCarrierLookup method returns a response identifying if a given phone number is a cellphone, landline, or invalid number. It also identifies if the number is an international number and the carrier it is associated with.

While GetCarrierLookup can serve as a standalone service to check phone numbers, it is most commonly utilized in conjunction with the Verify By Text process (RequireVBT and RequestVBT) to check if a phone number is a cellphone prior to initiating an opt-in for text messages.

Example

C#

lblError.Text = "";
GroupClient generalService = new GroupClient("ReportWSServiceHttpEndpoint2");
    string securityToken = txtToken.Text;
    string orgCode = txtOrgCode.Text;
    string[] phone = txtPhone.Text.Trim().Split(',');
WSCarrierLookupResponse wSCarrierLookupResponse = generalService.GetCarrierLookup(securityToken, phone, orgCode);
        if (!wSCarrierLookupResponse.Result)
            {
                //handle error
                lblError.Text = wSCarrierLookupResponse.Message;
            }
        else
            {
                //handle success
                lblError.Text = wSCarrierLookupResponse.Message;
            }

SOAP

Soap Request 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://SBTService/ServiceContracts/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:GetCarrierLookup>
         <!--Required:-->
         <ser:securityToken>Security Token</ser:securityToken>
         <!--Required:-->
         <ser:phone>
            <!--Zero or more repetitions:-->
            <arr:string>Phone Number</arr:string>
         </ser:phone>
         <!--Required:-->
         <ser:orgCode>Org Code</ser:orgCode>
      </ser:GetCarrierLookup>
   </soapenv:Body>
</soapenv:Envelope>
            
Soap Response
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetCarrierLookupResponse xmlns="http://SBTService/ServiceContracts/">
         <GetCarrierLookupResult z:Id="i1" xmlns:a="http://SBTAPIService/DataContract/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
            <a:Result>true</a:Result>
            <a:ErrorCode>1436</a:ErrorCode>
            <a:Message>Resolve carrier executed successfully</a:Message>
            <a:Response>
               <a:WSCarrierPhoneRow z:Id="i2">
                  <a:CarrierCode>79</a:CarrierCode>
                  <a:Carrier>T-Mobile</a:Carrier>
                  <a:International>false</a:International>
                  <a:Invalid>false</a:Invalid>
                  <a:Landline>false</a:Landline>
                  <a:Phone>1234567890</a:Phone>
               </a:WSCarrierPhoneRow>
            </a:Response>
         </GetCarrierLookupResult>
      </GetCarrierLookupResponse>
   </s:Body>
</s:Envelope>

PHP (GET CARRIER FOR SINGLE NUMBER)

<?php
    $client = new SoapClient("<< GeneralWSService WSDL URL >>");
    $param = array(
		'securityToken' => 'securityToken',
		'phone' => array ('string'=>'12312312345'),
		'orgCode' => 'orgCode'
	);
	
		
$response = $client->__soapCall('GetCarrierLookup', array($param));
echo '
';
print_r($response);
if($response->GetCarrierLookupResult->Result){
	echo 'Message: '.$response->GetCarrierLookupResult->Message;
}
else {
	echo 'Message: '.$response->GetCarrierLookupResult->Message;
}
?>

 


EXAMPLE 2: GET CARRIER FOR MULTIPLE NUMBERS

<?php
    $client = new SoapClient("<< GeneralWSService WSDL URL >>");
    $param = array(
		'securityToken' => 'securityToken',
		'phone' => array ('string'=>array('12312312345','12341234123')),
		'orgCode' => 'orgCode'
	);
	
		
$response = $client->__soapCall('GetCarrierLookup', array($param));
echo '
';
print_r($response);
if($response->GetCarrierLookupResult->Result){
	echo 'Message: '.$response->GetCarrierLookupResult->Message;
}
else {
	echo 'Message: '.$response->GetCarrierLookupResult->Message;
}
?>

REST

Method: GET

URL for singlenumber lookup:

https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/GeneralRSService.svc/GetCarrierLookup?securityToken=securityToken&phone=[PhoneNumber]&orgCode=orgCode

URL for multiple number lookup:

URL: https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/GeneralRSService.svc/GetCarrierLookup?securityToken=SecurityToken&phone=[12223334444,12223334445,12223334446]&orgCode=OrgCode

Note: The “phone” parameter in the request with List<String> should pass these parameters as a list per the sample C# code shown below.

Sample C# Code:

var listOfPhones = new string[] { "test", "test123", "test456" };
                var ArrlistOfPhones = JsonConvert.SerializeObject(listOfPhones).ToString();                
                System.Net.WebClient webClientGet = new System.Net.WebClient();
                Uri getURi = new Uri("https://ui.solutionsbytext.com/SBT.App.SetUp/RSServices/GeneralRSService.svc/GetCarrierLookup?securityToken=" + "safdsfs" + "&phone=" + ArrlistOfPhones + "&orgCode=" + "dfsf" + "");
var GetCarrierLookupResponse = webClientGet.DownloadString(getURi);
Note: “GetCarrierLookupResponse” will be in JSON format.

Response:

The response will be in JSON format like below:
{" GetCarrierLookupResult": {
   "Result": true,
   "ErrorCode": 1436,
   "Message": " Resolve carrier executed successfully",
   "Response": { "List<WSCarrierPhoneRow> response – List of carrier Phone in JSON format" }
}}

 Send Feedback

Back to all documentation