Airport codes api countries - parameters

The Javascript and PHP classes provided in the sample code should take care of the endpoint and the headers for you. It is helpful to understand them in case you need to write any custom code that we haven't provided.

Endpoint

For this API request, you will need to hit the following endpoint.

https://www.air-port-codes.com/api/v1/countries

Headers

In order to be granted access to the API, all of your requests must include an APC-Auth header that includes your API Key. An APC-Auth-Secret header can also be supplied for special cases where a referrer cannot be found, however, in most cases it will not be necessary.

Name Action Description
APC-Auth Required Your unique 10 digit alphanumeric Air-Port-Codes API key. This can be located in your account settings.
APC-Auth-Secret Optional Your unique 15 digit alphanumeric Air-Port-Codes API secret. You should NOT need to use this from Javascript unless you are running the script outside of a server, from an app or local testing (file://...). In most cases you won't need to use this if you add a proper domain to your account. It is more secure without it!

Parameters

This is a list of the optional parameters that can help you retrieve the desired response.

Name Action Description
is_select_options Optional This will return the countries object as a string of options for a select tag, rather than an array of objects, if it is set to true.
autoselect_visitor_location Optional Allows you to have the visitors country auto selected in a select field.
highlight Optional A comma separated string of country iso's that you want listed at the top of your select list. Example: 'US,CA,GB,AU'
selected Optional This will select the specified country in the select field.
ip_address Optional You can pass in an ip address and have the select field auto selected to the ip address' country.