API:Api-samplerequest

From InClickAdServer

Contents

Documentation Purpose

NOTICE: We are in the process of rewriting the API documentation.

The API Request Example is designed to assist developers in using the inClick Ad Server API by providing an example of an API Request for data. This API Example includes a PHP based example.

Summary

With the inClick Ad Server API, developers can manage data within the inClick Ad Server regardless of the ad servers location, local or remote. It is through the use of the API that allows developers to integrate the inClick Ad Server with third party services. Developers can also create their own user interfaces around the inClick Ad Server API.

Setting Up inClick Developers API

In this example setup, we will be using the DOCUMENT_ROOT location on a web server. You may change this as needed.

Step 1: Unpack inClick Developer API Package

Download and unpack / unzip the inClick Developer API package locally maintaining the directory / folder structure. Once unpacked, the directory structure should look like this:

../inclick_api/
../inclick_api/docs/
../inclick_api/export/
../inclick_api/test/
  • /docs/ - This contains the technical documentation outlined all of the available objects available within the API. This also outlines file dependencies for each object.
  • /export/ - This is the inClick Developers API client files. For ease of use and readability, files are contained in folders named around their function within the platform.
  • /test/ - These are the unit tests we perform on the API. These are provided for reference.

Step 2: Upload inClick Developer API Files to Server

Upload the contents of the /export/ folder to the document root folder on your web server. This should result in a single folder named /classes of which will contain 13 more folders.

Step 3: Unpack the PHPOlait Package

Download and unpack / unzip the PHPOlait package locally maintaining the directory / folder structure. Once unpacked, the directory structure should look like this:

../phpolait/

Step 4: Upload PHPOlait to Server

Upload the folder /phpolait/ to the document root folder on your web server.

Step 5: Create a Test API Query

The following is a simple API query that will obtain an accounts balance. This can serve as a basis for other Developer API queries.

  • Create a /globals directory, and a file globals.php
  • Within this file (globals.php), insert the following: Replace "your.inclickadserver.com" with the URL of your inClick Cloud Server, and "XXXXXXXXXXXXXXX" with your inClick Developer API Key that was issued to you.
    NOTICE: We suggest changing the $_SERVER['DOCUMENT_ROOT'] with the actual path since $_SERVER['DOCUMENT_ROOT'] may not be available from the command line, where your API request could be triggered by a cron job or event where this environment variable may not exist.
  • Create a file test.php in the root directory.
  • Within this file (test.php), insert the following:

Step 6: Test the Query

Visit test.php from your web browser. You should see something like this:

Account Balance for Account Number 1001: 10.00

If you receive an error, the code and error message will be provided.