Minnesota Cities, Townships and Unorganized Territories (CTUs): Service Access API

Overview

You may access the data found in the Minnesota CTU database via a web service interface using the file query.pl. This allows end users to create programs that use the data without having to store it in a local database, thus avoiding the need to periodically update the local data source to reflect changes.

Querying this data is accomplished by sending parameters which get converted into a SQL statement on our server. Results are returned to the requesting process in XML format. Prior to the construction of the SQL statement on our server, the user supplied parameters are parsed and sanitized (i.e. words such as 'drop', 'delete' and characters such as ";" are removed to prevent SQL injection attacks).

When a properly formatted query is sent to query.pl, results are returned wrapped in a <response></response> tag. Each line of response is wrapped in a <result> tag. Additionally, to assist in development / debugging, the response also includes the following fields:

<ERROR>: An error message in the event a blocked string was included in the other parameters
<SELECT>: The select clause as received by our server.
<WHERE>: The where clause as receive by our server.
<ORDER>: The order clause as receive by our server.
<SQL>: The SQL statement created as a result of the parameters sent, and processed by our database.

Parameters

select: A comma separated list of fields you wish returned. Fields are case insensitive. Available fields are:

GNIS_FEATURE_ID_INTEGER
GNIS_FEATURE_ID_TEXT
FEATURE_NAME
CTU_TYPE
LATITUDE
LONGITUDE
CENSUS_CODE
ANSI_COUNTY_CODE
COUNTY_NAME
COUNTY_CODE_AND_FEATURE_ID
STATE_COUNTY_CODES_FEATURE_ID
COUNTY_CODE_AND_CENSUS_CODE
FIPS
ACTIVE_OR_HISTORICAL
DATE_CREATED
DATE_EDITED

where: Any valid SQL limiting where clause (excluding the word 'where')

order: Any valid SQL ordering clause (excluding the words 'order by')

Examples