GetCongressionalDistrictByZip
The GetCongressionalDistrictByZip
method returns the Congressional District data for a given ZIP Code.
Endpoint
GET (HTTP): https://pav3.cdyne.com/PavService.svc/GetCongressionalDistrictByZip?ZipCode={ZIPCODE}&LicenseKey={LICENSEKEY}
GET (HTTPS): https://pav3.cdyne.com/PavService.svc/rest_s/GetCongressionalDistrictByZip?ZipCode={ZIPCODE}&LicenseKey={LICENSEKEY}
Syntax
GetCongressionalDistrictByZip(ZipCode, LicenseKey)
Request Parameters
Parameter Name | Description | Data Type | Required | Sample Value |
---|---|---|---|---|
ZipCode |
ZIP Code. |
String
|
True | 23320 |
LicenseKey |
Your license key. |
String
|
True | F01d89fd-5155-5455-5585-e84ab8de8591 |
Response
Returns: CongressionalDistrictResponse
object
Code Samples
// http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GetCongressionalDistrictByZip.WSDL;
namespace GetCongressionalDistrictByZip
{
class Program
{
static void Main(string[] args)
{
WSDL.PavServiceClient PSC = new WSDL.PavServiceClient("pavsoap");
WSDL.CongressionalDistrictResponse CDR = new WSDL.CongressionalDistrictResponse();
CDR = PSC.GetCongressionalDistrictByZip("23320", "YOUR LICENSE KEY");
if (CDR.ReturnCode == 0)
Console.WriteLine("Congressional District Found: " + CDR.CongressionalDistrict);
else if (CDR.ReturnCode == 1)
Console.WriteLine("Invalid input.");
else if (CDR.ReturnCode == 2)
Console.WriteLine("Invalid license key.");
else if (CDR.ReturnCode == 3)
Console.WriteLine("Congressional District not found.");
else if (CDR.ReturnCode == 4)
{
Console.WriteLine("Multiple Congressional Districts Found:" + "\n");
foreach (Char CongressionalDistrict in CDR.CongressionalDistrict)
{
Console.WriteLine(CDR.CongressionalDistrict);
}
}
Console.ReadLine();
}
}
}
<cfhttp method="GET" url="http://pav3.cdyne.com/PavService.svc/GetCongressionalDistrictByZip" result="result">
<cfhttpparam type="URL" name="ZipCode" value="23320">
<cfhttpparam type="URL" name="LicenseKey" value="YOUR LICENSE KEY">
</cfhttp>
<cfset xmlDoc = XmlParse(#result.FileContent#) />
<cfdump var="#xmlDoc#" />
' http://pav3.cdyne.com/PavService.svc?wsdl was added as Service Reference and given the name WSDL
Imports GetCongressionalDistrictByZip.WSDL
Module Module1
Sub Main()
Dim PSC As New PavServiceClient("pavsoap")
Dim CDR As New CongressionalDistrictResponse
CDR = PSC.GetCongressionalDistrictByZip("23320", "YOUR LICENSE KEY")
If CDR.ReturnCode = 0 Then
Console.WriteLine("Congressional District Found: " + CDR.CongressionalDistrict)
ElseIf CDR.ReturnCode = 1 Then
Console.WriteLine("Invalid input.")
ElseIf CDR.ReturnCode = 2 Then
Console.WriteLine("Invalid license key.")
ElseIf CDR.ReturnCode = 3 Then
Console.WriteLine("Congressional District not found.")
ElseIf CDR.ReturnCode = 4 Then
Console.WriteLine("Multiple Congressional Districts Found:" & vbLf)
For Each CongressionalDistrict As [Char] In CDR.CongressionalDistrict
Console.WriteLine(CDR.CongressionalDistrict)
Next
End If
Console.ReadLine()
End Sub
End Module
<?php
$client = new SoapClient('http://pav3.cdyne.com/PavService.svc?wsdl');
$param = array(
'ZipCode' => '23320'
, 'LicenseKey' => 'YOUR LICENSE KEY'
);
$result = $client->GetCongressionalDistrictByZip($param);
echo "<pre>";
print_r($result);
echo "</pre>";
?>
{
"CongressionalDistrict": "02",
"ReturnCode": 4
}
<CongressionalDistrictResponse xmlns="pav3.cdyne.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<CongressionalDistrict>02</CongressionalDistrict>
<ReturnCode>4</ReturnCode>
</CongressionalDistrictResponse>