Work in Progress.

The API url to perform ecnow actions:


To access all DXI API interfaces, all requests need to have an access
token which will authorize requests for a particular account for a fixed period
of time. These requests are also restricted to the internet address that
requested the token. The token API documentation can be read here.

The Database API has a number of available functions. The request arguments can all
be passed as HTTP POST or GET variables:


The response from the API can be formatted in either JSON, XML or CSV format.
The default is XML but this can be modified by the format argument.

With the exception of CSV import and export, the API will output a number of
optional values depending on the request made. However every request will return
a success value, essentially denoting if the request failed or not.

success: Did the request succeed. value: true or false (JSON) | 1 or 0 (XML)
error: If the request failed, this field will contain a description of the fault.

Example JSON return:

	{"success":false,"error":"Bad argument: xyz"}

Example XML return:

	<result><success>1</success><error>Bad argument: xyz</error></result>


The following are arguments available on all Database API requests.

format: xml, json or csv - specify the input and output data formats. Defaults to xml.
action: specify the command to perform: create, read, update or delete.
method: see below - specify the database method to access.


Almost all methods using the read action can have their data filtered when
exporting the data. The filters available are dependant on the method used and
are documented in their relevant sections.

The following are arguments available on all read requests.

limit: integer - limit the returned entires to the first N values. Defaults to all values.
	Note: the total value will still show the total number of records that would have
	been returned as if no limit filter was specified.

sort: string - sort the result by the specified field. Defaults to no sorting.
	Note: add " DESC" to the argument to sort in reverse order.


When uploading files for the create, update or delete actions, in default mode
the API expects the data in multipart/form MIME format via a HTTP POST request,
with the input file marked with an easycall name field. For example in a
basic HTML form this would look something like the following:

	<form name="myform" enctype="multipart/form-data" action="https://api.dxi.eu/database.php?action=create&format=xml" method="POST">
	    <input type="hidden" name="method" value="{method}">
	    <input type="hidden" name="token" value="{token}">
	    Send this file: <input name="easycall" type="file">
	    <input type="submit" value="Send XML File">

The API accepts input files in XML, JSON or CSV format using plain text (ascii)
or UTF-8 encoded data. The API does not accept data in UTF-16 encoding.

To assist in uploading large data files or connections over slow links the
uploaded files can be compressed as .zip, .gz or .bz2 formats. The uploaded
filename must have the appropriate file extension for the API to detect
if compression was used.

Currently the API HTTP layer cannot process upload requests with the "Expect:
100-Continue" header and will fail with an error "417 - Expectation Failed".
Unfortunately this is the default in a number of software libraries and
languages, however it can be disabled in all those we have encountered so far.

Using PHP + CURL this would be done something like:

	curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));

or with .NET:

	System.Net.ServicePoint.Expect100Continue = false;


The alternative to this is if the optional argument raw is set to 1, defaults to unset.

This is only valid on a POST request and then instead of a multipart/form-data upload,
the input data is taken as is. So instead of an attachment the data can be sent as a
raw text stream. However this does not support audio files uploads or compressed file formats
and is meant for small XML or JSON requests.


Examples to create two new agents:

	<?xml version='1.0' encoding='utf-8' ?>
			<name>Fred Smith</name>
			<name>Suzy Sue</name>

	[{"name":"Fred Smith","pin":1234,"username":"fsmith100","password":"qwerty1234"},
	 {"name":"Suzy Sue","pin":2345,"username":"suzysue","password":"abcdef1234"}]

	Fred Smith,1234,fsmith100,qwerty1234
	Suzy Sue,2345,suzysue,abcdef1234

Manipulate reseller information and read config vars.

	uid: ccid of a reseller


	ccid - the unique ccid (readonly)
	name - the company name (readonly)
	parent - the ccid that owns this reseller (default 111) (readonly)
	campaign_builder - the database used to store some ecnow tables (readonly)
	domain_name - the webroot url that their system sits in (readonly)
	address1 -> 5 - address fields
	country - country the company is located in
	first_name - company representative first name
	last_name - company representative last name
	support_ddi - the number that should be called by their customers for support
	workphone - primary contact number
	mobilephone - secondary contact number
	email - multiple email addresses separated by commas that we send announcements to
	email_from - the email address we send our automated emails to their customers from
	invoice_email - the email address to send invoices to

access per queue flags that affect the user interface

	qid: a single qid or comma separated list of qids


	qid - the unique qid (readonly)
	campaignid - the contact centre reference number (readonly)
	hidden - 1 if the queue is hidden (default 0)
	tpt_customer_cli - the database used to store some ecnow tables (readonly)

contract centre extra information, such as billing information, contact info, and flags that affect the whole contact centre interface

	campaign: a single campaign id


	campaignid - the contact centre reference number (readonly)
	campaign_name - (readonly)
	database_name - (readonly)
	campaign_type - '' or 'contract' to hide the balance
	script_text - all queue script text, overriden by queue specific script text
	date_created (readonly)
	manualcall - Y or N to allow all agents to use manual call
	webphone - Y or N to allow all agents to use webphone login
	softphone - Y or N to allow all agents to use softphone login
	deskphone - Y or N to allow all agents to use deskphone login
	show_callbacks - Y or N to allow all agents to see their agent specific callbacks on the wait page
	cb_lookahead - How far ahead to show callbacks for
	show_balance_agent - Y or N to show balance to agents
	show_balance_supervisor - Y or N to show balance to supervisors
	allowed_ips - comma separated list of ips that can be used to login from, can use wildcards % (e.g. 212.%.234.%,213.%.%.%)
	pauserecording - Y or N to allow agents to pause recording, useful when taking sensitive information
	invoice_email - the email address to send invoices to
	advert_info - some variables describing how the user arrived at our product (readonly)

agent flags that affect the interface

	agent: a single agent id or comma separated list of agent ids


	agentid - unique agent reference number (readonly)
	selfserve_id - the contact centre reference number (readonly)
	hidden - 1 if the queue is hidden (default 0)

the tables within a contact centres database (known as campaign on the interface)


	name - table name (readonly)

Manipulate EasycallNow datasets.

	qid: queue id or comma seperated list of queue id's
	dataset: dataset id
	state: d_status value (HOLD|LIVE|EXPIRED)
	table: the campaign table name datasets were imported into


	<notes />
	<callbacks />
	<recount />

Manipulate EasycallNow data records.

        One of these is required:
        table: the campaign database name
        dataset: the dataset id

	id: match a record on its ID field
	outcome: match outcomecode or comma seperated list of outcomecodes
	agent: agent specific records
	ddi: match any phone numbers
	search: array of search params eg array("firstname" => "john", "lastname" => "c")


	<id />
	<homephone />
	<mobilephone />
	<workphone />
	<callback />
	<outcomecode />
	<agent_specific />
	<call_back_sametime />

	<custom fields />

Disposition a customer record in the database, may remove the record from the dialler if a complete outcome is given

Only the update action is valid for this method.


	id - match ID field in campaign table (required)
	dataset - the dataset the record is in, used to identify which campaign table (required)
	outcomecode - the outcome to set against this customer record (required)
	processdate - will set this new process date and will only update if the current process date is less than this value

Modify the custom fields in a campaign table

	table - the campaign table
	name - the field name


	name - the name of the field in the database campaign table
	standard_field - greater than zero if it was a standard field when created
	group_name - the group the field is in eg Phone Numbers, Name and Address, System etc
	size - the size of the field (usually number of allowed characters)
	order - can be used to sort the fields into a specific order
	picklist - if this field has a predefined set of values, references 'picklist' filter in 'picklist' method
	table - the campaign table this field is in
	type - the type of field ('smalltext'/'varchar', 'select', 'radio', 'checkbox', 'largetext')
	prompt - an alias for the field, shown on the agent screens
	readonly - disables the input on agent screens
	search - allows search on the field on the inbound screen
	hidden - does not show the field on agent screns

Create a predefined set of values for a campaign field

	picklist - the name of the picklist to retreive all the value => description pairs for


	picklist - the picklist this value => description pair is in
	value - the actual value of this picklist option
	description	- the text used to represent this value in the list

Manage a list of contacts for conferencing or third party transfers

        uid - the contact id
	name - the contact name


        contact_id - the unique identifier number
	name - the unique name for a contact
	number - their phone number
	email	- their email address

Create an agent script, essentially just a grouping of script_pages with extra options

	uid - the script_id


	script_id -
	description -
	campaign_id -
	auto_save - causes the editable fields to auto save values (0 off, 1 on)

Create script pages to for your agent scripts

	group - the script_id this page belongs to
	page - the page number


	script_id -
	page -
	campaign_id -
	script_text - the plain text, html, and replacable tokens {{fieldname}}, [[fieldname]], <button type='button' class='btn' onclick='page(2)'>Go to page 2</button>