Skip to main content

createCards

Overview

This service allows you to create new card records.
It performs the same function as creating a card in the Cards / Card Details tab does.

Permissions

To run this API, the nominated 'web-services' role needs to be given permission.
If you are not actively using the API, leave the permission off for better security.
Go to Roles / Apis and check on Cards:Create .

This API is not configured for external use but can be made available on request.

Contact Catch-e Support to request this update.

HTTP Method

Use the HTTP Method 'POST' for consuming this web service.

URL Examples

https://api.demo.catch-e.com/authenticate 
https://api.{{environment}}.catch-e.com/authenticate 
https://api.test.catch-e.com/fm/cards 

Input Fields (Header)

Key

Format

Notes

Mandatory

Audit-User-Id

string

User ID that you want to show as the user in audit records.

To use this Key, the authorised role must have the permission Audit:UserIdOverride enabled.

No

Input Fields (Body)

JSON Field

Format

Notes

Mandatory

contract_id

number

The Contract ID the card should be linked to.

Yes

card_number

number

Card number provided by the supplier.

Yes

supplier_id

number

The supplier the card is linked to. [fm_suppliers]supplier_id.

Yes

account_number

number

Account number of the card

no

posting_flag

Text

This updates [fm_cards]posting_flag and defaults to 'yes' if it is not specified.

no

recharge_flag

Text

This updates [fm_cards]recharge_flag. If this Key is not specified the value will default from the linked Contract Types / Expense-Approvals "R" fild for the โ€˜F - Fuelโ€™ record.

no

client_id_recharge

Number

This updates [fm_cards]client_id_recharge. If this Key is not specified, the Client ID that is attached to the Contract will be used. Cannot be blank if โ€œPosting Enabledโ€ flag = โ€˜yesโ€™.

no

history Only

Text

([fm_cards]history_only_flag) โ€“ These defaults from Clients / Contract Defaults "History Only".

no

date Activated

Text

([fm_cards]activated_date).

no

date Inactivated

Text

([fm_cards]inactivated_date).

Yes

expiry Date

Text

([fm_cards]expiry_date).

no

card_sub_status_id

Number

Pass the sub status you want for the card. I.e. [fm_cards]card_sub_status_id.

no

status_flag

Text

Pass the status of the card. The default entry is 'active'.

no

notes

Text

Notes to be stored with the attachment

no

Audit-User-Id

Number

User Id to use for audit purposes. This header requires the Audit: UserIdOverride permission to be associated with your role.

no

Successful Response Example

{ "_links": { "self": { "href": "https://api.test.catch-e.com/fm/cards/" } }, "_embedded": { "fm_cards": [ { "card_id": "100312", "contract_id": "104274", "card_number": "081412438765", "account_number": "4354365", "supplier_id": "100515", "posting_flag": "yes", "recharge_flag": "no", "client_id_recharge": "100240", "history_only_flag": "no", "activated_date": "2021-09-26", "inactivated_date": "2022-09-03", "expiry_date": "2023-09-03", "card_sub_status_id": "100001", "status_flag": "active", "notes": "kavyatest", "_links": { "self": { "href": "https://api.test.catch-e.com/fm/cards/100312" } } } ] }, "total_items": 1 } 

Error Response Details

401 Unauthorized

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Unauthorized", "status": 401, "detail": "Unauthorized" }

You have not authenticated before running this API or the token_timeout of the current session has passed. You need to authenticate again.

403 Forbidden

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Forbidden", "status": 403, "detail": "Forbidden" }

You do not have permissions for this request. Go to System Roles and enter 'web_services'. Navigate to the Roles / APIs tab to make sure the permission you need to run this API is checked.

422 Failed Validation

}, "target_table": { "notInArray": "Unsupported target table" }, | "

Unsupported target table

 "contract_id": { "isEmpty": "Value is required and can't be empty"

Contract_id is missing

 "card_number": { "duplicateCardNumber": "The specified card number already exists"

""The specified card number already exists with same supplier ".

 "card_sub_status_id": { "noRecordFound": "No record matching the input was found"

Enter a valid id from [fm_card_sub_statuses]

 "client_id_recharge": { "noRecordFound": "No record matching the input was found"
 "expiry_date": { "dateFalseFormat": "The input does not fit the date format 'Y-m-d'", "dateInvalidDate": "The input does not appear to be a valid date"

Invalid date

 "posting_flag": { "rechargeClientRequired": "Recharge A/c be blank if 'Posting Enabled' is checked on"

' Recharge A/c' cannot be blank if 'Posting Enabled' is checked on!

"supplier_id": { "noRecordFound": "No record matching the input was found"

500 - Internal Error

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "string", "status": 0, "detail": "string" }

You do not have permissions for this request.