westclicks

web development, software and tutorials.

Web Services

Country - States Lists

Currently we provide country state lists accessible under several formats. Select a country from the list below and you will get a list of the corresponding state/locale/canton etc for the country using the international double format 'AA'.

Select a Country

Select a format

How to Use The Web Service

The service is comprised of URL calls.
There are a only a few variables to use in the name-value-pair request in the URL:

format
f=format
where format is either:
  • json a json object
  • jsarray a javascript array
  • option an html option list
country
(optional) if you are after the states in the country
c=country
where country is the international double character designation for the country
ie. AU for Australia

thus you end up with a query string something like:
f=json&c=US
Which you pass to the webservice as:
http://www.westclicks.com/webservices/?f=json&c=US

NOTE: to get a list of all countries simply omit the country 'c' variable form the query string and pass only the format.
f=json

Clicking on the following link will return a page with an option string of all the countries: http://www.westclicks.com/webservices/?f=option
Clicking on the following link will return a page with a json string of the states in Australia: http://www.westclicks.com/webservices/?f=json&c=AU