How To Use Api

Table of contents:

How To Use Api
How To Use Api

Video: How To Use Api

Video: How To Use Api
Video: APIs for Beginners - How to use an API (Full Course / Tutorial) 2024, November
Anonim

Surely every programmer has come across an API (application programming interface) or application programming interface. At its core, it is a specific set of classes, functions, constants that are provided by an application, service or operating system. Used by software developers to write various software products.

How to use api
How to use api

Instructions

Step 1

Use the VKontakte social network API for Flash applications. To use the programming interface of this site, download a file called APIConnection.zip from the developer page. Unpack the downloaded archive into the folder with the source files of the application that will interact with the library. In order to start working with APIConnection, connect the vk. APIConnection class to your project. Create an instance of this class. The flashVars object is the only parameter to its constructor. Here's an example of initializing an application:

var flashVar: Object = stage.loaderInfo.parameters as Object;

var VK: APIConnection = new APIConnection (flashVar);

Step 2

Use the Google maps API. This interface is used to place maps on your page. To get started, get the key at https://code.google.com/intl/ru/apis/maps/signup.htm. Further use it on your page:

If you want to try using the map on localhost, you can leave the {your key} parameter blank. Connect the maps API. To do this, enter the code shown above. After that, paste in the html code:

Please note - the block with the id map inside will contain the map data. To display the map, paste the JavaScript code:

function initialize () {// This function will be called when the page is loaded.

if (GBrowserIsCompatible ()) {// Check if the browser is compatible with maps

var map = new GMap2 (document.getElementById ("map")); // Create an instance of the map class, where map is the id of the block in which you want to display the installed map.

map.setCenter (new GLatLng (62.424198, 25.962219), 15); // Set the coordinates of the map. 15 is the scale of the map.

}

}

Be sure to pay attention to the declaration of the coordinates of the geographic object for which the map is displayed.

Recommended: