Get City State Province returns a city and state/province for a given input postal code.
Note: Get City State Province works with U.S. and Canadian addresses only.
Get City State Province is part of Spectrum Universal Address.
Resource URL
JSON endpoint:
http://server:port/rest/GetCityStateProvince/results.json
https://OnDemandServer/rest/GetCityStateProvince/results.json
XML endpoint:
http://server:port/rest/GetCityStateProvince/results.xml
https://OnDemandServer/rest/GetCityStateProvince/results.xml
http://server:port/soap/GetCityStateProvince
https://OnDemandServer/soap/GetCityStateProvince
For a list of Spectrum Technology Platform servers, see Connecting to Servers.
Example with JSON Response
The following example requests a JSON response:
http://myserver:8080/rest/GetCityStateProvince/results.json?Data.PostalCode=12180
https://spectrum.precisely.com/rest/GetCityStateProvince/results.json?Data.PostalCode=12180
The JSON returned by this request would be:
{"output_port": [{
"ProcessedBy": "USA",
"PostalCode": "12180",
"City": "TROY",
"StateProvince": "NY",
"Country": "USA",
"City.Type": "P",
"user_fields": []
}]}
Example with XML Response
The following example requests an XML response:
http://myserver:8080/rest/GetCityStateProvince/results.xml?Data.PostalCode=12180
https://spectrum.precisely.com/rest/GetCityStateProvince/results.xml?Data.PostalCode=12180
The XML returned by this request would be:
<ns2:xml.GetCityStateProvinceResponse
xmlns:ns2="http://www.pb.com/spectrum/services/GetCityStateProvince">
<ns2:output_port>
<ns2:Result>
<ns2:ProcessedBy>USA</ns2:ProcessedBy>
<ns2:PostalCode>12180</ns2:PostalCode>
<ns2:City>TROY</ns2:City>
<ns2:City.Type>P</ns2:City.Type>
<ns2:StateProvince>NY</ns2:StateProvince>
<ns2:Country>USA</ns2:Country>
<ns2:user_fields/>
</ns2:Result>
</ns2:output_port>
</ns2:xml.GetCityStateProvinceResponse>
Example
The following shows a SOAP request:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:get="http://www.pb.com/spectrum/services/GetCityStateProvince">
<soapenv:Header/>
<soapenv:Body>
<get:GetCityStateProvinceRequest>
<!--Optional:-->
<get:input_port>
<get:Input>
<!--Optional:-->
<get:PostalCode>60510</get:PostalCode>
<!--Optional:-->
<get:user_fields>
<get:user_field>
<get:name></get:name>
<get:value></get:value>
</get:user_field>
</get:user_fields>
</get:Input>
</get:input_port>
</get:GetCityStateProvinceRequest>
</soapenv:Body>
</soapenv:Envelope>
This would be the response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns3:GetCityStateProvinceResponse xmlns:ns2="http://spectrum.precisely.com/" xmlns:ns3="http://www.pb.com/spectrum/services/GetCityStateProvince">
<ns3:output_port>
<ns3:Result>
<ns3:ProcessedBy>USA</ns3:ProcessedBy>
<ns3:PostalCode>60510</ns3:PostalCode>
<ns3:City>BATAVIA</ns3:City>
<ns3:City.Type>P</ns3:City.Type>
<ns3:StateProvince>IL</ns3:StateProvince>
<ns3:Country>USA</ns3:Country>
<ns3:user_fields/>
</ns3:Result>
</ns3:output_port>
</ns3:GetCityStateProvinceResponse>
</soap:Body>
</soap:Envelope>