REST Web Services
Our REST based web services are called using a URL directly over HTTPS with additional input values passed as POST or GET parameters. A response is given in the form of a simple XML document.
Security
Using HTTPS to consume our web services provides a high level of security. For increased security, each web service call must include the login and password of an existing user account in the POST (or GET) parameters. This user account must belong to the role 'web_services'. If no such user exists in Catch-e, you will need to create one first.
Web Services are accessed by using a user login with a 'webservice' role. If a login fails, this will be recorded in the gb_users_access_log table.
Output Format Selection
By default, the web service will respond with data in an XML format. This can be changed by passing the rest_response_format variable in your POST/GET request to the REST endpoint.
The REST interface currently supports two response mode values: xml and json.
Example web service call utilising a JSON response format:
https://yourname.catch-e.net.au/services/fm/drivers/signon?driver_id=100000&surname=Quinn&rest_response_format=json Code Examples
Consuming Web Service from JQuery
The following example uses the popular JQuery JavaScript library. You would need to replace values such as 'username' with applicable values:
var webserviceAPI = 'https://yourname.catch-e.net.au/services/qt/quotes/getQuote?login=username&password=password&rest_response_format=json&output_mode=fields"e_id=100000'; $.getJSON(webserviceAPI, function(data) { // data contains the JSON response data if (data.error == undefined) { // web service call successful // Example referencing data from the JSON response alert(data.quote.quote_id); } else { // web service error has been triggered // Failure reason contained in JSON structure alert('An API error has been triggered: ' + data.error); } }).fail(function() { // Failure invoking web service URI alert('An API error has occured. Aborting...'); }); Consuming Web Service from PHP
The following example uses the Curl library. You need to replace values such as 'yourname' with applicable values:
if (strstr(PHP_OS, 'WIN') && !extension_loaded('curl')) { dl('php_curl.dll'); } $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl_handle, CURLOPT_HTTPPROXYTUNNEL, 0); curl_setopt($curl_handle, CURLOPT_URL, 'https://yourname.catch-e.net.au/services/fm/drivers/signon?driver_id=100000&surname=Quinn'); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, 'login='.urlencode('??????').'&password='.urlencode('#######')); $curl_result = explode("\r\n\r\n", curl_exec($curl_handle)); Consuming Web Service from .NET
Note: This C# code snippet is indicative and not production ready.
protected string FetchesWebPageUsingHttpRequest(StringDictionary sd, string url, string method) { string postParameters = ""; // used to build entire input StringBuilder sb = new StringBuilder(); // used on each read operation byte[] buf = new byte[8192]; // prepare the web page we will be asking for HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); if (method == "POST") { // Add each of the input elements to the request IEnumerator e = sd.GetEnumerator(); while (e.MoveNext()) { DictionaryEntry de = (DictionaryEntry)e.Current; postParameters += "&" + de.Key + "=" + de.Value; } request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postParameters.Length; } // Set the method type "POST" or "GET" request.Method = method; // Write the request StreamWriter stOut = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII); stOut.Write(postParameters); stOut.Close(); // Do the request to get the response StreamReader stIn = new StreamReader(request.GetResponse().GetResponseStream()); string strResponse = stIn.ReadToEnd(); stIn.Close(); return strResponse.ToString(); } Legacy Web Services
Warning: Our password based legacy web services are no longer supported by Catch-e. You must use the token based APIs instead. New use of legacy web services is not authorised by Catch-e.
Overview
This page documents our legacy web services that are password based. Visit the APIs page for details about our current token based APIs.
Legacy Web Services are being progressively deprecated with a planned end date of 31/12/2024. Access is managed by Catch-e staff using the control 'webservices_access_flag'.
When these services have been deprecated, your HTML quote will need an update to continue work. Visit the Quote Template Setup page for the update details.
Legacy Web Service Families
General Ledger (gl)
Class: system
The 'system' family of web services provides administrative calls for maintenance of the general ledger sub-system.
Global (gb)
Class: system
The 'system' family of web services provides system access operations.
Class: record
The 'record' family of web services provides access to the database for CRUD operations.
Class: attachments
The 'attachments' family of web services provides attachment handling operations.
Warning: The 'attachments' family of web services has been deprecated and is no longer supported by Catch-e. You must use APIs > Attachments to develop attachment API functions.
Class: systemmaintenance
The 'systemmaintenance' family of web services provides access to maintenance processes at the system level.
Fleet Management (fm)
Class: drivers
Quick Quotes (qq)
Class: vehicle_lookup
Warning: The vehicle_lookup family has been deprecated and is no longer supported by Catch-e. You must use Quotes / Variants APIs instead.
Class: vehicle
Quick Quotes Lease (qq / lease)
Class: lease
The 'lease' family of web services provides access to the novated lease calculation engine in the Catch-e Quotes module.
Salesforce (salesforce)
Class: quotes
The 'salesforce' family of web services provides access to sales related functionality within Catch-e, e.g. generating quotes, creating drivers, printing quote PDFs.
Quotes (quotes)
Class: quotes
The 'quotes' family of web services provides access to quote related functionality from Catch-e.
Migration Path
The following table summarizes the migration path from legacy web services to current token-based APIs:
Notes
All legacy web services requiring deprecated functionality should migrate to the corresponding token-based APIs
XML and JSON response formats are supported for REST services
Web service user accounts must be configured with the 'web_services' role
HTTPS is required for all web service calls
End of support for legacy services is 31/12/2024
Your HTML quote templates will need updating when legacy services are fully deprecated