The GetIntelligentMailBarcode
method returns Intelligent Mail Barcode data using the key obtained from the VerifyAddressAdvanced
method.
Endpoint
GET:https://pav3.esendex.us/PavService.svc/GetIntelligentMailBarcode?BarcodeIdentifier={BARCODEIDENTIFIER}&ServiceTypeIdentifier={SERVICETYPEIDENTIFIER}&MailerIdentifier={MAILERIDENTIFIER}&SerialNumber={SERIALNUMBER}&IntelligentMailBarcodeKey={INTELLIGENTMAILBARCODEKEY}&LicenseKey={LICENSEKEY}
Syntax
GetIntelligentMailBarcode(BarcodeIdentifier, ServiceTypeIdentifier, MailerIdentifier, SerialNumber, IntelligentMailBarcodeKey, LicenseKey)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
BarcodeIdentifier | Barcode identifier. (Consult USPS.com for more info.) | String | True | |
ServiceTypeIdentifier | Service type identifier (STID). (Consult USPS.com for more info.) | String | True | |
MailerIdentifier | Mailer identifier (assigned by USPS). | String | True | |
SerialNumber | Serial number. (Consult USPS.com for more info.) | String | True | |
IntelligentMailBarcodeKey | Barcode key returned from calling VerifyAddressAdvanced method. | String | True | |
LicenseKey | Your license key. | String | True | 00000000-0000-0000-0000-000000000000 |
Response
Returns: IntelligentBarcodeResponse
object
Code Samples
You can use any programming language you want with our API, as long as it can make a REST or SOAP call. Here are examples for some of the most common platforms.
C#
// https://pav3.esendex.us/PavService.svc?wsdl was added as a Service Reference and given the name WSDL
using System;
using WSDL;
var config = PavServiceClient.EndpointConfiguration.pavws_secure;
var client = new PavServiceClient(config);
var barcodeIdentifier = "12";
var serviceTypeIdentifier = "123";
var mailerIdentifier = "123456";
var serialNumber = "123456789";
var intelligentMailBarcodeKey = "dw/cKC9h9Au0zJy+WGvQkQ==";
var licenseKey = "YOUR_LICENSE_KEY";
var response = await client.GetIntelligentMailBarcodeAsync(
barcodeIdentifier, serviceTypeIdentifier, mailerIdentifier, serialNumber, intelligentMailBarcodeKey, licenseKey);
var returnCodeDescription = response.ReturnCode switch
{
0 => "Success",
1 => "Invalid input",
_ => "Unknown return code"
};
Console.WriteLine($"Return Code: {response.ReturnCode} - {returnCodeDescription}");
Console.WriteLine($"Intelligent Mail Barcode: {response.Barcode}");
Console.ReadLine();
JavaScript
const params = new URLSearchParams({
'BarcodeIdentifier': '12',
'ServiceTypeIdentifier': '123',
'MailerIdentifier': '123456',
'SerialNumber': '123456789',
'IntelligentMailBarcodeKey': 'dw/cKC9h9Au0zJy+WGvQkQ==',
'LicenseKey': '00000000-0000-0000-0000-000000000000'
});
const url = 'https://pav3.esendex.us/PavService.svc/GetIntelligentMailBarcode?' + params.toString();
const options = {
headers: {
'Accept': 'application/json'
}
};
const response = await fetch(url, options);
const json = await response.json();
console.log(json);
JSON Response
{
"Barcode": "String content",
"ReturnCode": 0
}
PHP with cURL
<?php
$client = new SoapClient('https://pav3.esendex.us/PavService.svc?wsdl');
$param = array(
'BarcodeIdentifier' => '12'
, 'ServiceTypeIdentifier' => '123'
, 'MailerIdentifier' => '123456'
, 'SerialNumber' => '123456789'
, 'IntelligentMailBarcodeKey' => 'dw/cKC9h9Au0zJy+WGvQkQ=='
, 'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->GetIntelligentMailBarcode($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>
Python
import httpx
headers = {"Accept": "application/json"}
url = "https://pav3.esendex.us/PavService.svc/GetIntelligentMailBarcode"
request = {
"BarcodeIdentifier": "12",
"ServiceTypeIdentifier": "123",
"MailerIdentifier": "123456",
"SerialNumber": "123456789",
"IntelligentMailBarcodeKey": "dw/cKC9h9Au0zJy+WGvQkQ==",
"LicenseKey": "00000000-0000-0000-0000-000000000000",
}
with httpx.Client(headers=headers) as client:
response = client.get(url=url, params=request)
response.raise_for_status()
print(response.json())
Ruby
require 'json'
require 'net/http'
headers = { Accept: 'application/json', 'Content-Type': 'application/json' }
uri = URI('https://pav3.esendex.us/PavService.svc/GetIntelligentMailBarcode')
params = {
'BarcodeIdentifier': '12',
'ServiceTypeIdentifier': '123',
'MailerIdentifier': '123456',
'SerialNumber': '123456789',
'IntelligentMailBarcodeKey': 'dw/cKC9h9Au0zJy+WGvQkQ==',
'LicenseKey': '00000000-0000-0000-0000-000000000000'
}
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get(uri, headers)
raise response.message if response.is_a?(Net::HTTPClientError) || response.is_a?(Net::HTTPServerError)
puts JSON.parse(response)
XML Response
<IntelligentBarcodeResponse xmlns="pav3.esendex.us">
<Barcode>String content</Barcode>
<ReturnCode>0</ReturnCode>
</IntelligentBarcodeResponse>