MDM

Table Dml

Function: table_dml

Type: API Endpoint (POST)

Purpose:
Executes data manipulation operations (insert, update, delete) on a specified table in the customer database based on the provided input data.

URL:
POST /api/mdm/table_dml

Request Headers:

  • Customer_Key (str, required): A base64 encoded string containing lscode and firmcode for the customer. This must be decoded for database access.

Request Body:

  • input_data (TableDMLRequest, required): Contains the table name and lists of data for insert, update, and delete operations.

Response:

  • Returns a JSON object with a success message if the operations are successful.

Exceptions:

  • Handles exceptions related to invalid customer key format, missing idx for update/delete operations, and database errors, providing appropriate error messages.

Steps:

  1. Customer Key Decoding:
    Decodes the Customer_Key to extract the lscode and firmcode. Raises an error if the format is invalid.

  2. Input Validation:
    Validates the presence of table_name and that the data for insert, update, and delete operations are in list format.

  3. Database Connection:
    Establishes a connection to the database using custCursorConnection.

  4. Data Manipulation:
    Executes insert, update, and delete operations on the specified table using the input data.

  5. Transaction Handling:
    Commits the transaction if all operations are successful, or rolls back in case of an error.

  6. Logging:
    Logs the API call with details of the operation.

  7. Response Construction:
    Returns a success message or error details based on the outcome of the operations.

post/api/mdm/table_dml

Headers

Customer-Keystring required

Request body

userstring required

The user performing the operation

timestring required

The time of the operation

table_namestring required

The name of the table to perform operations on

insertValueobject[]

List of records to insert

updateValueobject[]

List of records to update

deleteValueobject[]

List of records to delete

Response

Successful Response

object required

Changes

No recorded changes to this endpoint across all 1 revision of this API.