createCardImport
createCardImport
Overview
This method uploads a CSV file of cards for a supplier and validates every row. Each row is classified as create, update, invalid, duplicate or unauthorized, and the results are stored against a new import batch. No cards are created or updated until the batch is processed.
This API is part of the card import process:
createCardImport – upload and validate the CSV file.
getCardImportErrors – download the rows that failed validation (optional).
processCardImport – create and update the valid cards.
getCardImportResult – download the final outcome for every row.
Validation rules
supplier_idmust be supplied and must be a card-services supplier.Each row must contain either
contract_idorreg_no.If
reg_nomatches more than one active contract, the row is invalid.If a card with the same
supplier_idandcard_numberalready exists, the row is an update; otherwise it is a create.Rows in the same file with the same
supplier_idandcard_numberare duplicate.status_flagmust beactiveorinactive;deletedis rejected.A missing Cards:Create permission does not invalidate update rows, and a missing Cards:Update permission does not invalidate create rows.
This method only requires an authenticated user. Permissions are checked for each row: create rows need the Cards:Create permission and update rows need the Cards:Update permission. Rows you are not authorised to process are classified as unauthorized rather than blocking the request.
Permissions
The permissions for this api are stored in [gb_api_permissions]permission as 'Cards:Create' and 'Cards:Update'.
Only roles with a stored link to these permissions in [gb_role_api_permissions] can create or update cards through this api.
HTTP Method
Use the HTTP Method 'POST' for consuming this web service.
URL Examples
https://api.demo.catch-e.com/fm/cards/imports https://api.{{environment}}.catch-e.com/fm/cards/imports https://api.test.catch-e.com/fm/cards/imports Input Fields (Header)
Input Fields (Form Data)
The request body is sent as multipart form data (multipart/form-data).
CSV columns
Response Details
Success
201 - Created
The batch was created and all rows validated. Check import_allowed to see whether the batch can be processed.
{ "import_batch_id": "1234", "summary": { "total": 10, "valid": 8, "invalid": 1, "duplicate": 1, "unauthorized": 0 }, "import_allowed": true, "error_report_available": true } Error Response Details
{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Unauthorized", "status": 401, "detail": "Unauthorized" } { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Forbidden", "status": 403, "detail": "Forbidden" } { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Not Acceptable", "status": 406, "detail": "Not Acceptable" } { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Unsupported Media Type", "status": 415, "detail": "Not Acceptable" } { "warning_messages": {}, "validation_messages": { "fieldName": { "validationExceptionCode": "A textual description of the validation exception" } }, "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Unprocessable Entity", "status": 422, "detail": "Failed Validation" } { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "string", "status": 599, "detail": "string" } { "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "string", "status": 599, "detail": "string" }