Overview

All functions listed under Application API are all API calls that you will want to use for deployed applications. Application API calls require your API key. You can think of the API key as a “safe password” for use by your applications–this “safe password” cannot be used for any Developer API functions.

In order to get information from the API, you need to send a POST request to the URL:

Request URL:

http://www.serialsense.com/api/<API CALL HERE>

Replace <API CALL HERE> with the Application API call that your deployed application needs.

Sample Request URL:

http://www.serialsense.com/api/get_data

Each Application API function has a list of required–and sometimes optional–API parameters. The API parameters are sent to the Request URL in the same fashion that a POST request is typically sent: through an array of POST variables! Below is a quick PHP sample, using the CURL library, of a POST API request.

/**
 * Setup API request and parameters to DEACTIVATE a machine using
 * end-user's license.
 */
$request = 'http://www.serialsense.com/api/deactivate';
$params = array(
	'apikey' => '2c9a123_EXAMPLE_API_KEY',
	'code'   => $license_alias,  // license alias stored locally
	'mach'   => $machine_id     // unique machine id generated locally
	);
 
// initialize and setup CURL
$curl = curl_init($request);
curl_setopt($curl, CURLOPT_POST,              true);
curl_setopt($curl, CURLOPT_POSTFIELDS,        $params);
curl_setopt($curl, CURLOPT_CONNECTIONTIMEOUT, 10);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,    1);
$result = curl_exec($curl);
 
// any CURL errors?
if (curl_errno($curl))
{
	echo 'CURL Error No.:' . curl_errno($curl) . '<br>';
	echo 'CURL Error Msg:' . curl_error($curl) . '<br>';
}
else
{
	curl_close($curl);
}
 
// we're done!
echo 'CURL Result: <br>' . $result;

Format of API Call Results

If the API call’s results were put into a plain text file, the result string would look as follows:

<license>
Return_Result

Each line ends with only a new-line character (“\n”). To ensure your application that the result is coming from the licensing server, the first line will always return <license>. The second line is always the returned result from the API function call. If an API call returns an array of results, then anything afterwards will be an additional element of the return array. In summary, every line contains the following information:

  1. License server’s identifier tag.
  2. API call’s returned result string.
  3. For each additional new line, this is another element of the result string array.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This site is using OpenAvatar based on