GetCityStateProvince
GetCityStateProvince returns a city and state/province for a given input postal code.
Note: GetCityStateProvince works with U.S. and Canadian addresses only.
GetCityStateProvince is part of Spectrum Universal Address.
Resource URL
JSON endpoint:
http://server:port/rest/GetCityStateProvince/results.json
XML endpoint:
http://server:port/rest/GetCityStateProvince/results.xml
Example with JSON Response
The following example requests a JSON response:
http://myserver:8080/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
The XML returned by this request would be:
<ns2:xml.GetCityStateProvinceResponse
xmlns:ns2="http://www.precisely.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>