API Example Sites List
From InClickAdServer
Domain Level Approvals - List Domains
This API Service Request list the Domains (Domain Level Approval) available within the system.
The Code Example
<?php require_once "globals/globals.php"; require_once (INCLICK_EXTERNAL_CLASSES_DIR . "/publisher_sites/IMG_PublisherSiteManagerClient.php"); $site_manager = new IMG_PublisherSiteManagerClient(INCLICK_WEB_URL, INCLICK_API_KEY); $site_request = new IMG_PublisherSiteListRequest(); $site_request->setPublisherID(-1); //SET PUBLISHER ID $site_request->setStatusFilter(-1); //SET FILTERED VIEW $site_request->setResultsPerPage(-1); // SET THE NUMBER OF RECORDS PER PAGE $site_request->setCurrentPage(-1); //SET THE CURRENT PAGE NUMBER $result = $site_manager->getPublisherSiteList($site_request); if($result->succeeded() == 1) { $site_result = $result->getReturnValue(); } else { } ?>
Breaking Down the Code
require "globals/globals.php";
This require references the local inClick Ad Server deployment configuration files allowing your code to utilize the pre-packaged API Objects as well as the bundled PHPOlait services.
require_once INCLICK_BASE_DIR . "/classes/publisher_sites/IMG_PublisherSiteManagerClient.php";
This require contains the API Objects and Classes needed for this API Service Request.
$site_manager = new IMG_PublisherSiteManagerClient(INCLICK_WEB_URL, INCLICK_API_KEY); $site_request = new IMG_PublisherSiteListRequest();
This creates the instance of the classes needed to create API Service Request.
$site_request->setPublisherID(-1); //SET PUBLISHER ID $site_request->setStatusFilter(-1); //SET FILTERED VIEW $site_request->setResultsPerPage(-1); // SET THE NUMBER OF RECORDS PER PAGE $site_request->setCurrentPage(-1); //SET THE CURRENT PAGE NUMBER
This creates the settings for the API Service Request.
- setPublisherID - Available values:
- -1: All Publishers
- Account Number for the Publisher to filter the view to.
- setStatusFilter - Filters the view to the domains approval status. Available values are:
- -1: View all status types
- 1: Pending Review
- 2: Approvad
- 3: Declined
- setResultsPerPage - Sets the number of records per page. -1 will show all results in a single page.
- setCurrentPage - If the results can span more than on page, this will allow you to page the data. -1 ignores this setting.
$result = $site_manager->getPublisherSiteList($site_request);
This sends the request to the inClick Cloud Server deployment.
if($result->succeeded() == 1) { $site_result = $result->getReturnValue(); print_r($site_result); } else { echo "Request Failed - Message: " .$result->getErrorMessage(); }
This section is provided to give a visual confirmation of what occurred.
Last Updated: 01/12/2017