This URL interface provides direct access to the Washington Department of Revenue's latitude and longitude based tax rate lookup technology platform. Using the URL interface we provide, you can access sales and use tax data by providing a latitude and longitude that reside somewhere in Washington state. The following information is the technical specifications for accessing the URL interface.
For technical questions or assistance with these interfaces, please contact our GIS team at dordli.s.gisteam@dor.wa.gov
1. The tax rate lookup URL interface is designed to return the current sales tax rates for a given latitude and longitude. It is designed for use by AJAX (XMLHttpRequest, Msxml2.XMLHTTP), libcurl, wget, HttpRequest, or similar HTTP protocol clients. Requests can be made to return either XML or plain text responses.
http: or https: ///webapi/LatLongRates.aspx?output=&latitude=&longitude= Where ==> Host name where the service is running. ==> Either "xml" or "text"
The service will normally return HTTP 200 OK. If an uncaught internal error occurs, it may return an HTTP 500 internal server error. Generally, the ResultCode is the most reliable means of determining the cause of errors.
A result code will be returned for both XML and text response formats. The codes are defined as:
0: The address was found. 1: The address was not found, but the ZIP+4 was located. 2: The address was updated and found, the user should validate the address record 3: The address was updated and Zip+4 located, the user should validate the address record 4: The address was corrected and found, the user should validate the address record 5: Neither the address or ZIP+4 was found, but the 5-digit ZIP was located. 6: The address, ZIP+4, and ZIP could not be found. 7: Invalid Latitude/Longitude 9: Internal error
If the format requested is "text", a simple tab delimited text string will be returned with the following format.
LocationCode= Rate= ResultCode= Where LocationCode ==> The four digit DOR location code. Rate ==> The total state and local tax rate. ResultCode ==> The result code described above. Example LocationCode=3406 Rate=0.084 ResultCode=0
Example Response Tags response ==> The response package. rate ==> The tax rate information. Attributes loccode ==> The four digit DOR location code. localrate ==> The local tax rate. rate ==> The combined local and state tax rate. code ==> The result code as defined above. errormsg ==> A description of the error that occurred. Attributes name ==> DOR location code name (usually the city). county ==> The county this location code resides in. code ==> The four digit DOR location code. staterate ==> The state portion of the sales tax rate. localrate ==> The local portion of the sales tax rate.
double latitude = 47.985; double longitude = -122.596; WebClient wc = new WebClient(); wc.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705)"); string urlPrefix = "/LatLongRates.aspx?output=xml"; string completeUri = urlPrefix + "&latitude=" + HttpUtility.UrlEncode(latitude.ToString()) + "&longitude=" + HttpUtility.UrlEncode(longitude.ToString()); StreamReader reader = new StreamReader(wc.OpenRead(completeUri)); string xml = reader.ReadToEnd(); reader.Close();// parse the XML response here...// ...