David Swinton
posted this on March 23, 2011 04:30 pm
Application developers may wish to access call logs from a Neural termiantion or PBX account via API. This article outlines how to access this data in CSV format via either HTTP or HTTPS.
You can export your call logs via URL using the following string. Replace the values in bold with those appropriate for your query.
https://voip.neural.net.au:15000/?mod=report-export-<direction>&user=<user>&pass=<password>&repType=<period>&download=true&inline=true
Direction:
Inbound or outbound call logs. One of:
in - Inbound call logs
out - Outbound call logs
User:
Your portal username
Password:
Your portal password
Period:
The period over which the export should run. One of:
live - Today, up to the minute
30day - The previous 30 days (exc today)
60day - The previous 60 days (exc today)
You may also specify a custom time period.
Inline
Determines whether the response will be 'inline' data or 'attachment' data. Inline data returns the CSV data as the inline HTML reponse. If you remove this section of the URL, data will instead be sent in attachment format, which forces the browser to treat the CSV as a file download, rather than a web page. Most retrieval methods (cURL, wget, etc.) prefer inline.
A working example would look something like...
https://termination.neural.net.au:15000/?mod=report-export-in&user=test&pass=s3cr3t&repType=30day&download=true&inline=true
CSV Data Return
The CSV data will be returned
If HTTPS is unsuitable for your application, the same API is also available on HTTP. Simply remove the 's' from https and change the port to 16000.
For example:
http://termination.neural.net.au:16000/?mod=report-export-out&user=test&pass=s3cr3t&repType=live&download=true&inline=true
Some development environments (such as .NET) don't always get along well with HTTPS, so this can be used as an alternative.
Sample code for this function is also available in the knowledge base.
Comments
There have been some further updates to the API's output in relation to diverted calls. There is now an additional field at the end of each line for a diverted call showing the originating callers caller id. Please see the export page in termination manager for updated output formatting.