API Overview & Authentication: Consume Web Service Rest

API authentication, restrictions, and getting started

Consume Web Service Rest

Our REST based web services are called using a URL directly over HTTPS with additonal input values passed as POST or GET parameters. A response is given in the form of a simple XML document.

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 gbusersaccesslog table.

Output format selection

By default, the web-service will respond with data in an XML format.

This can be changed by passing the restresponseformat 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

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&quote_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

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 and the planned end date is 31/12/2024.
Access is managed by Catch-e staff using the control 'webservicesaccess_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.

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.

General Ledger (gl)

Method:Synopsis
Class: system The 'system' family of web services provides administrative calls for maintenance of the general ledger sub-system.
[Warning:] reserveBatchNosreserveBatchNos has been deprecated and is no longer supported by Catch-e. You must use ReserveBatchNosWebService instead.
------
reserveInvoiceNosreserveInvoiceNos has been deprecated and is no longer supported by Catch-e. It is not being replaced with a Token API.
[Warning:] reservePaymentNosreservePaymentNos has been deprecated and is no longer supported by Catch-e. You must use the ReservePaymentNosWebService API instead. === Global (gb)===
Method:Synopsis
------
executeScriptexecuteScript has been deprecated and is no longer supported by Catch-e. You must use the executeScript(https_//api.test.catch-e.com/docs/#/queries/executescript-executescript) API instead.
exportQuery)Executes a SELECT type query, stored in gb_queries, returning the output directly in an XML format. This service is typically used by external systems as an export interface.
[Warning:] queryquery) has been deprecated and is no longer supported by Catch-e. You must use the Print a report query API instead.
Class: record The 'record' family of web services provides access to the database for CRUD operations.
Method:Synopsis
------
[Warning:] upsertupsert) has been deprecated and is no longer supported by Catch-e. You must use the Insert or update a record with auditing API instead.
readRecord)This web service is in the process of being deprecated and is no longer supported by Catch-e. Allows you to read values for a single record
------
lockRecordlockRecord has been deprecated and is no longer supported by Catch-e. It is not being replaced with a token API.
unlockRecordunlockRecord has been deprecated and is no longer supported by Catch-e. It is not being replaced with a token API.
------
deleteLockdeleteLock has been deprecated and is no longer supported by Catch-e. You must use the deleteLocks(https_//api.test.catch-e.com/docs/#/other/deletelocks-deletelocks) API instead.
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.
Method:Synopsis
------
saveAttachment)Allows you to save an attachment via a web service rather than using the regular web-based attachment upload function.
loadAttachment)Allows you to load attachment source details via a web service.
------
deleteAttachment)Allows you to delete an attachment via a web service.
Class: system The 'system' family of web services provides system access operations.
Method:Synopsis
getToken)Allows you to access a web service via a token rather than using a login and password. This allows you to securely to call a web service directly from your web page.
useToken)Consume a web service using a token issued by getToken.
[Warning:] signonsignon) has been deprecated and is no longer supported by Catch-e. You must use the Generate a signon token API instead.
------
reserveMailBatchNosreserveMailBatchNos has been deprecated and can no longer be run.
[Warning:] reserveInterfaceBatchNosreserveInterfaceBatchNos has been deprecated and is no longer supported by Catch-e. You must use the ReserveInterfaceBatchNosWebService API instead.
Class: systemmaintenance The 'systemmaintenance' family of web services provides access to maintenance processes at the system level.
Method:Synopsis
rebuildCostCentreAllocations)Allows you to rebuild the fmcontractcostcentreallocations table. This can be useful after you have imported some 'CC' type contract events, and want to run certain reports straight away, e.g. the Accidents report. The scheduler typically runs this at 10pm daily.
rebuildDivisionAllocations)Allows you to rebuild the fmcontractdivision_allocations table. This can be useful after you have imported some 'DIV' type contract events, and want to run certain reports straight away, e.g. the Accidents report. The scheduler typically runs this at 10pm daily.
rebuildDriverAllocations)Allows you to rebuild the fmcontractdriver_allocations table. This can be useful after you have imported some 'DRIVER' type contract events, and want to run certain reports straight away, e.g. the Accidents report. The scheduler typically runs this at 10pm daily. === Fleet Management (fm)===
Method:Synopsis
signon)Issues a single signon session id that can by-pass the login screen once only. This service is normally used from a secure web page, e.g. from an intranet page that itself is password protected, so the user doesn't have to log into both systems. === Quick Quotes (qq)===
------
[Warning:]The vehicle_lookup family has been deprecated and is no longer supported by Catch-e. You must use Quotes / Variants APIs instead.
Method:Synopsis
getMakes)Get a list of vehicle makes as make_id / name pairs. Suitable for use in a list box.
------
getModels)Get a list of models for a given vehicle make as model_id / name pairs. Suitable for use in a list box.
getModelYears)Get a list of model years for a given vehicle model. Suitable for use in a list box, using as both the option and value properties.
------
getBodyTypes)Get a list of bodytypeid / body_type pairs for a given vehicle model and model year. Suitable for use in a list box.
getVariants)Get a list of variant_id / description pairs for a given vehicle model, model year, and body type. Suitable for use in a list box.
------
getVariant)Get field values for a given vehicle variant returning individually requested fields or all fields if none are requested. These values can be used with other services in the lease web services family, e.g. getQuote.
getVariantPhotos)Get list of photo codes and corresponding types for a given vehicle variant. Photo codes are provided by the vehicle data supplier, and are typically used as the file name for each image. Types describe the orientation of the photo e.g. 'front'.
------
getOptionalEquipment)Get list of optional equipment and price for a given vehicle variant. The value returned is in a Description and List Price (Gross) pair identified by a unique id.
getStandardEquipment)Get list of standard equipment for a given vehicle variant. The value returned is the Description identified by a unique id.
Class: lease The 'lease' family of web services provides access to the novated lease calculation engine in the Catch-e Quotes module.
Method:Synopsis
------
[Warning:] getQuotegetQuote) has been deprecated and is no longer supported by Catch-e. You must use getQuickQuoteWebService instead.
Class: salesforce The 'salesforce' family of web services provides access to sales related functionality within Catch-e. eg. generating quotes, creating drivers, printing quote PDF's.
Method:Synopsis
[Warning:] createQuotecreateQuote) has been deprecated and is no longer supported by Catch-e. You must use the createQuoteWebService API instead.
Class: quotes The 'quotes' family of web services provides access to quote related functionality from Catch-e.
Method:Synopsis
------
[Warning:] copyQuotecopyQuote has been deprecated and can no longer be run. Use the copyQuote API instead.
[Warning:] getQuotegetQuote) is no longer supported by Catch-e. You must use the getQuoteFieldsWebService or Render Quote PDF API instead.
getDealerOrder)This web service is in the process of being deprecated and is no longer supported by Catch-e. Generates dealer order (default format is Excel) based on an existing Catch-e quote.
------
getAftermarketOrdergetAftermarketOrder has been deprecated and can no longer be run.
[Warning:] recalculateQuoterecalculateQuote) has been deprecated and is no longer supported by Catch-e. Use the patchQuote API instead.