Softonic API

Javascript client

The Javascript library shows how to access the Softonic API using client-side code.

A simple example code:

<script language="JavaScript" type="text/javascript" src="softonic.js"></script>
<script type="text/javascript">

	/**
	* Api Callback function.
	*/
	function api_test_echo( data )
	{
		if ( "ok" == data.status && "Test" == data.value )
		{
			alert( "OK" );
		}
		else
		{
			alert( "KO" );
		}
	}

	api = new SoftonicAPI( " your_api_key" );
	api.testEcho( "Test", "api_test_echo" );

</script>

Download: This code and other examples are packed with the Toolbox.

IMPORTANT Since the API needs always a Key to return data, if you put the following code in your website anyone could view the source of your page and steal your API key. You should use Javascript techniques only in private/intranet environments to prevent your key from being stolen.