Client APIs
From The Contingency Market
Being provided via SOAP, The Contingency Market web service could have APIs developed for it in many languages. At present only a PHP client API to the web service has been developed.
For documentation of the API see Service.
Download
The PHP5 client library v0.10 is now released
Version 0.10 of the source code (GPL v2) is downloadable as a MediaWiki extension here: Media:CMExtension 0.10.zip. This extension is the basis to the one currently installed on this site.
To install, you'd copy the ContingencyMarket folder to the extensions directory and then append to LocalSettings.php as appropriate, e.g.
$wgContingencyMarketConfig=array();
$wgContingencyMarketConfig['DB_HOST']='localhost'; // CM Database Host
$wgContingencyMarketConfig['DB_USER']='user'; // CM Database Username
$wgContingencyMarketConfig['DB_PASS']='pwd'; // CM Database Password
$wgContingencyMarketConfig['DB_NAME']='db'; // CM Database Name
$wgContingencyMarketConfig['SITE_USER']='mymarket@example.com'; // CM Site username (default user when none other authenticated)
$wgContingencyMarketConfig['SITE_PASS']=md5('pwd'); // CM Site Password
$wgContingencyMarketConfig['SITE_NAME']='MyMarketplace'; // CM Site name
require_once("$IP/extensions/ContingencyMarket/Setup_CM.php");
The four tables that should be in the database are as follows:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE TABLE `cache` (
`signature` char(32) NOT NULL,
`family` int(10) unsigned NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`result` mediumblob,
UNIQUE KEY `signature` (`signature`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `changes` (
`object` enum('AgentNew','EventNewObservation','ContingencyCreated','ContingencyTerminated','OfferNew','DealNew','DealAccepted','DealRejected','DealCompleted') NOT NULL,
`serial` char(17) DEFAULT NULL,
`id` char(32) DEFAULT NULL,
PRIMARY KEY (`object`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `diagnostics` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`type` enum('unknown','php','sql','soap','cm','api') NOT NULL DEFAULT 'unknown',
`severity` enum('unknown','error','warning','notice','trace') NOT NULL,
`level` tinyint(4) NOT NULL DEFAULT '0',
`number` int(11) DEFAULT NULL,
`description` mediumtext NOT NULL,
`file` tinytext,
`line` int(11) DEFAULT NULL,
`operation` mediumtext,
`backtrace` mediumtext,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `session` (
`user_email` varchar(250) NOT NULL,
`id` bigint(20) unsigned NOT NULL DEFAULT '0',
`sequence` int(11) unsigned NOT NULL DEFAULT '0',
`ipaddress` varchar(20) NOT NULL DEFAULT '127.0.0.1',
`user_name` varchar(250) NOT NULL DEFAULT 'Anonymous',
`user_md5` char(32) DEFAULT NULL,
`user_id` char(32) DEFAULT NULL,
`lastused` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`user_email`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

