What is the JavaScript API?

The JavaScript API ships with a set of browser-based user interface components for easily embedding maps and other location-based capabilities in web pages. The API, together with the user interface components, enable you to create custom browser-based mapping applications.

The API can be used in a wide range of scenarios, from simply embedding maps in your web site to show locations, to creating rich web applications. Built entirely in JavaScript, the controls work without the need for any browser plug-ins and without having to write any server-side code. The components use Web 2.0 techniques to provide functionality such as seamless map panning and the ability to search and display information without requiring a web page refresh.

The following JavaScript API components are available:

Component Description
LegendControl A user interface control containing descriptive information about features appearing on a map. It also provides the means to show and hide individual overlays on a map.
FeatureService A non-user interface control, that lets developers write Javascript code to call the FeatureService REST API. This control can be used to query tables for features. Search results are returned as GeoJSON FeatureCollections. The search call is performed asynchronously.
MultiTableFeatureService A non-user interface control, that lets developers make FeatureService REST calls against multiple tables simultaneously. This is a convenience class, allowing a feature search on multiple tables which is useful when a feature search is triggered by interactions with a map, that typically display the features of multiple tables stacked on top of each other. For example, a SearchNearest against TABLE1 and TABLE2 at a given point (x,y).
OpenLayers layer types An easy way to display either a MappingService NamedMap or a TileService map tile on an OpenLayers map.
Generic data formatting Template formatting controls for developers to display JSON data in an OpenLayers popup (for example) but intelligently styled. For example, a Table name underlined, field names in italics, and field values in bold.
REST Services REST-ful service control for developers to send cross-domain calls to the REST services. These calls will be performed as asynchronous XMLHttpRequest calls.