System Records API: Gb Attachments deleteAttachment

Gb_* API endpoints for system record operations

Gb Attachments deleteAttachment

Warning: This web service has been deprecated and is no longer supported by Catch-e.
You must use APIs → Attachments to develop attachment API functions.

This web-service allows you to delete an attachment via a web service rather than using the regular web-based attachment upload function.

The system will set the of the attachment to 'deleted'. The record is left linked to the parent record, E.g. Event.

Input Fields

Query string keyFormatNotesMandatory
1attachment_idstringList the attachment_id that should be loaded.yes

Input URL Examples

https://yourname.catch-e.net.au/services/gb/attachments/deleteAttachment?login=######&password=######&attachment_id=100256

Output Fields

XML elementFormatNotesMandatory
1return_statusbool1 on successyes

Error Codes

Error Codes
1CATCHEERRORTOOMANY_REQUESTS

Gb Attachments loadAttachment

Warning: This web service has been deprecated and is no longer supported by Catch-e.
You must use APIs → Attachments to develop attachment API functions.

This web-service allows you to load an attachment via a web service rather than using the regular web-based attachment upload function.

This could be used to access attachments from another system.

Input Fields

Query string keyFormatNotesMandatory
1attachment_idstringList the attachment_id that should be loaded.yes

Input URL Examples

https://yourname.catch-e.net.au/services/gb/attachments/loadAttachment?login=######&password=######&attachment_id=100256

Output Fields

XML elementFormatNotesMandatory
1return_statusboolTRUE on successyes
2attachmentarrayThe stored attachment data structure. Only shown on success (see below)yes

The response contains a link that will need to be entity de-coded. The link will timeout after 20 seconds.

Output Example

Error Codes

Error CodesMode
12All
2CATCHEERRORTOOMANY_REQUESTSAll

Gb Attachments saveAttachment

Warning: This web service has been deprecated and is no longer supported by Catch-e.
You must use APIs → Attachments to develop attachment API functions.

This web-service allows you to save an attachment via a web service rather than using the regular web-based attachment upload function.

Please note, the files you want to save as attachments must be placed in your DMZ folder in the "attachments" directory before running the saveAttachment service.

When this service has been run, the system checked the file has been loaded and then removes the original file from the DMZ folder.

If you are unsure of your DMZ access details, please contact Catch-e Support for further assistance.

Input Fields

Query string keyFormatNotesMandatory
1target_tablestringName of target table e.g. fmcontractevents. Supported tables include: fmcontractevents fmdriverevents fmclientevents fmapprovals fmmaintenance bkbookingevents Please contact Catch-e support if your target table is not in this list.yes
2target_keystringThe field that holds the unique id that will be used to identify the target record (see below). This would normally be the id field. E.g contracteventidyes
3target_recordstringThe unique id of the record in the target table the attachment is to be associated with.yes
4filenamestringThe filename of the attachment to be stored. E.g. testfile1.docyes
5notesstringOptional notes to be stored with the attachment.no

Input URL Examples

https://yourname.catch-e.net.au/services/gb/attachments/saveAttachment?login=######&password=######&target_table=fm_contract_events&target_key=contract_event_id&target_record=116714&filename=testfile1.doc

Output Fields

XML elementFormatNotesMandatory
1return_statusboolTRUE on successyes
2attachmentarrayThe stored attachment data structure. Only shown on success (see below)yes

Output Example

true 100040 testfile txt testfile.txt 100540 2a75008348358778dd637bf3a533478a local 10000 [NULL] active

Error Codes

Error CodesModeNotes
1CATCHEERRORPERMISSIONDENIEDAllYour login credentials don't belong to the 'web_services' role.
2CATCHEERRORTARGETTABLE_MISSINGAllThe mandatory Input Field target_table is missing.
3CATCHEERRORTARGETTABLE_EMPTYAllThe mandatory Input Field target_table is empty.
4CATCHEERRORTARGETKEY_MISSINGAllThe mandatory Input Field target_key is missing.
5CATCHEERRORTARGETKEY_EMPTYAllThe mandatory Input Field target_key is empty.
6CATCHEERRORTARGETRECORD_MISSINGAllThe mandatory Input Field target_record is missing.
7CATCHEERRORTARGETRECORD_EMPTYAllThe mandatory Input Field target_record is empty.
8CATCHEERRORFILENAMEMISSINGAllThe mandatory Input Field filename is missing.
9CATCHEERRORFILENAMEEMPTYAllThe mandatory Input Field filename is empty.
10CATCHEERRORATTACHMENTDOESNOTEXISTAllThe named attachment could not be found in the FTP folder.
11ATTACHMENTSERRORFILESIZEEXCEEDEDAllThe maximum filesize supported by Catch-e has been exceeded (5MB). Contact Catch-e Support for further assistance.
12ATTACHMENTSERRORMIME_EXTENSIONAllA mime type id could not be resolved for the supplied attachment. Contact Catch-e Support for further assistance.
13ATTACHMENTSERRORPARENT_RECORDAllThe record determined by the targettable, targetkey and target_record could not be resolved.
14ATTACHMENTSERRORRENAME_FAILEDAllContact Catch-e Support for further assistance.
15ATTACHMENTSERRORIDENTICAL_FILEAllThe same file has already been uploaded.
16CATCHEERRORTOOMANY_REQUESTSAllRest call requests exceeded the limit set in .

Error Output

CATCHEERRORATTACHMENTDOESNOTEXIST

Gb Drivers signon

Synopsis

Issues a single signon session id that can by-pass the login screen only once.

Input Fields

Query string keyFormatNotesMandatory
1driver_idintegerUnique identifier for an fmdrivers record, must also have an active gbusers record of same value.yes
2SurnametextDriver surnameyes

Input URL Examples

https://yourname.catch-e.net.au/services/fm/drivers/signon?driver_id=100001&surname=Quinn
https://yourname.catch-e.net.au/core/services/rest/index.phpo?module=fm&script=drivers&action=signon&driver_id=100001&surname=Quinn&login=web_services&password=wouldntyouliketoknow

Output Fields

XML elementFormatNotesMandatory
1mixedXMLMixed column datayes

Output Example

signon=3f4afbd671aea676dce7a8d7a6ad1bed

Example Usage

window.location.href=https://yourname.catch-e.net.au/core/signon.phpo?signon=3f4afbd671aea676dce7a8d7a6ad1bed

This will default to the latest contract linked to driver_id used above. If you want system to default to a specific contract, you can pass in the required reg no as a parameter

window.location.href=https://yourname.catch-e.net.au/core/signon.phpo?signon=3f4afbd671aea676dce7a8d7a6ad1bed&default_reg_no=ABC123

Error Codes

  • 1 — The input field driverid is missing CATCHEERRORNODRIVERID_FIELD
  • 2 — The input field surname is missing CATCHEERRORNOSURNAME_FIELD
  • 3 — The input field driverid is empty CATCHEERRORNODRIVERID_VALUE
  • 4 — There is no fmdrivers record with the given driverid value CATCHEERRORNODRIVER
  • 5 — The input field surname value, does not match the surname value from fmdrivers for the given driverid CATCHEERRORDRIVERSURNAME
  • 6 — No applicable contracts exist for the given driverid. Applicable contracts have a drivercontractaccessflag set to 'yes', in their Contract Type, and cannot be an Order. CATCHEERRORNOCONTRACT
  • 7 — No login credentials found (i.e. not entry in gbusers) for the given driverid. An attempt will be made to create login credentials using details from fmdrivers. CATCHEERRORNODRIVERLOGIN
  • 8 — The statusflag in gbusers is set to 'locked'. CATCHEERRORDRIVERLOGIN_LOCKED
  • 9 — The statusflag in gbusers is set to 'suspended'. CATCHEERRORDRIVERLOGIN_SUSPENDED
  • 10 — Rest call requests exceeded the limit set in . CATCHEERRORTOOMANY_REQUESTS

Error Output

CATCHEERRORDRIVERLOGIN_LOCKED

Gb Queries executeQueries

This job type allows you to run a report in the form of an SQL query, and send the output as an email attachment. It is useful for sending regular reports both internally and externally. Using the Attachment Required checkbox, exception reports can be generated where an email is sent only if the report finds anything.

Visit the User Defined Queries page for instructions on writing queries for the scheduler.

Email attachments will be converted to URLs if they exceed your set size limit.

A few jobs have been set-up to email Catch-e Support directly. These Scheduler Exception Queries are to monitor possible data issues for you.

Field Descriptions

FieldTypeDescription
Parameters
Query IDNumberEnter or lookup the query_id to fuse in this job.

| Attachment Format | Drop List | Choose the required format for the attachment file from 'Office(xlsx))', 'Office(xls)', 'Text (csv)', 'Text (txt) or 'XML'. 'Office(xlsx))' is the default value and saves with an xlsx suffix. Further parameter variables are hidden if this format is chosen. 'Office(xls)'Format) enables you to customiseFormat) the presentation of the generated files. Further parameter variables are hidden if this format is chosen. 'Text (csv)' generates a text delimited file and uses the CSV, Comma Separated Variable, format. 'Text (txt)' generates a text delimited file and uses the Text (Tab Delimited) format. 'XML' generates an XML based file.
| Column Headings? | Check Box | Check to have the column headings included in the file as the first row. This only applies to the 'Text' Attachment Format. | |
| Separated By | Drop List | Set the character(s) used to separate columns / fields in the output. E.g. using the option '|' will create a pipe separated file. This only applies to the 'Text' Attachment Format. In the special case where {tab} is being used for the separator, all tabs in the data will be replaced with white spaces to conform to the IANA standard for TSV files. | |
| Text Delimited By | Drop List | Set the character used to delimit columns / fields in the output if they contain special characters. Special characters include double quotes, newlines, and this delimiter character itself. The 'none' option will add no delimiters and is useful when the query itself adds the delimiters e.g. creating a custom interface file to specification. This only applies to the 'Text' Attachment Format. | |
| Omit Final Line Break? | Check Box | Select so that the final line of output will not end in a line break. This is required by some third party software for import purposes. This is un-checked by default. This only applies to the 'Text' Attachment Format. | |
| Singleton Tags? | Check Box | if you tick this, tags with empty values will use the singleton style format e.g. as opposed to . This only applies to the 'XML' Attachment Format. | |
| Indent Size | | Input, this sets the indentation (whitespaces) used, this must be an integer between 0 and 9. The default is 2. This only applies to the 'XML' Attachment Format. | |
| Newlines? | Check Box | if you tick this, all lines will end in a newline character. This improves readability when viewing or printing the XML from non-specialized text editors. This only applies to the 'XML' Attachment Format. | |
| Run Times | | | |
| Report Queue | | Check this to send reports to the Report Queue. | |
| Queue | | | |
| Recycling | Check Box | Check to recycle the job when it completes successfully. If you are recycling a report and sending it to the Report Queue, the "Started" and "Completed" timestamp details on the Report Queue screen will be lost each the job is recycled. The reports will, however, still display in the correct run order. | |

Channel Logo's in reports

Where an executeQuery is written to include a Channel the resulting Office(xls) generated report can contain a channel specific logo, an example query can be seen below:

## Contracts active the beginning of this month#channel_id added to SELECT statementSELECT t1.contract_id,t1.asset_id,t1.contract_start,t1.contract_end,t1.suspend_date,t1.reg_no,t1.description,t2.client_code,t3.surname,t3.given_name, t4.posting_map_code, t2.channel_idFROM fm_contracts AS t1LEFT JOIN fm_clients AS t2 ON t1.client_id = t2.client_idLEFT JOIN fm_drivers AS t3 ON t1.driver_id = t3.driver_idLEFT JOIN gl_posting_maps AS t4 ON t1.posting_map_id = t4.posting_map_idWHERE (t1.suspend_date > DATE_FORMAT(ADDDATE(curdate, INTERVAL 0 MONTH), '%Y-%m-01')OR t1.suspend_date = '0000-00-00')AND t1.contract_start <= DATE_FORMAT(SUBDATE(curdate, INTERVAL 0 MONTH), '%Y-%m-01')AND t1.contract_start != '0000-00-00'AND t1.contract_end != '0000-00-00'AND t1. reg_no != 'ORDER'#channel_id added as a conditionAND t2.channel_id = 100000ORDER BY t1.contract_id;

Funds Check values

You can use Funds Check values in queries. See the sample query below:

## library_type standard## library_path /lib/PDF## library_name funds_checkSELECT rm.description,pmr.type,pm.posting_map_code,c.contract_id,c.reg_no,c.contract_start,c.contract_end,c.suspend_date,c.terminated_date,'->funds_finance_budget' AS funds_finance_budget,'->funds_finance_actual' AS funds_finance_actual,'->funds_finance_variance' AS funds_finance_variance,'->funds_finance_available' AS funds_finance_available,'->funds_finance_posting_class_codes' AS funds_finance_posting_class_codes,'->funds_finance_report_budget_as_actual' AS funds_finance_report_budget_as_actual,'->funds_finance_available_to_claim' AS funds_finance_available_to_claim,'->funds_unmapped_budget' AS funds_unmapped_budget,'->funds_unmapped_actual' AS funds_unmapped_actual,'->funds_unmapped_variance' AS funds_unmapped_variance,'->funds_unmapped_available' AS funds_unmapped_available,'->funds_unmapped_posting_class_codes' AS funds_unmapped_posting_class_codes,'->funds_total_budget' AS funds_total_budget,'->funds_total_actual' AS funds_total_actual,'->funds_total_variance' AS funds_total_variance,'->funds_total_available' AS funds_total_available,'->funds_received' AS funds_received,'->funds_variance' AS funds_variance,'->funds_available_balance' AS funds_available_balance,'->funds_actual_balance' AS funds_actual_balancefrom fm_contracts AS cINNER JOIN gl_posting_maps AS pm ON pm.posting_map_id = c.posting_map_idLEFT JOIN gl_posting_map_reporting AS pmr ON pmr.posting_map_id = c.posting_map_id AND pmr.type = 'funds_check'LEFT JOIN gl_reporting_maps AS rm ON rm.reporting_map_id = pmr.reporting_map_idwhere contract_id = 102940group by c.contract_idORDER BY c.contract_id