MDM NEW

Columnlist

Function: ColumnList Type: API Endpoint (GET)

Purpose:
This API endpoint retrieves a paginated list of columns from a specified table for a particular customer based on the provided customer_key.

URL:
GET /api/new_mdm/column_list/?page=<page_num>&limit=<limit_num>

Request Headers:

  • Customer-Key (Header, required):
    A base64 encoded string that contains lscode and firmcode, separated by a pipe (|).
  • Table-Name (Header, required):
    The name of the table from which to retrieve column details.

Steps:

  1. Log Creation:
    Generates a unique log ID based on the current timestamp to track each request.
  2. Customer Key Decoding:
    The Customer-Key is decoded from base64 and split into lscode and firmcode. If the format is invalid, an error message is returned.
  3. Database Connection:
    The custCursorConnection function uses lscode and firmcode to connect to the specific customer’s database.
  4. Query Execution:
    Retrieves the column data for the specified Table_Name from the [dbo].[LS_Custom_Columns] table. Results are filtered by Active Flag and paginated based on page and limit parameters.
  5. Result Processing:
    The query results are formatted as a list of dictionaries, handling data types such as Decimal and datetime for JSON serialization.
  6. Response Construction:
    A JSON response is returned with the formatted list of column details.

Response Example:

[
    "total_count": <total_count>,
    "table_details": [
        {
            "Table Name": "<Table Name>",
            "Description": "<Description>",
            "Error Type": "<Error Type>",
            "Delete Option": "<Delete Option>"
        }
    ],
    "columns": [
        {
            "LSCode": "<LSCode>",
            "LSFirmCode": "<LSFirmCode>",
            "Table": "<Table>",
            "column_id": "<column_id>",
            "Column Name": "<Column Name>",
            "Data Type": "<Data Type>",
            "Length": "<Length>",
            "Scale": "<Scale>",
            "Required": "<Required>",
            "Column Type": "<Column Type>",
            "Reference Type": "<Reference Type>",
            "Description": "<Description>",
            "Default Value": "<Default Value>",
            "Compute Formula": "<Compute Formula>",
            "Sequence": "<Sequence>",
            "Active Flag": "<Active Flag>",
            "Created By": "<Created By>",
            "Date Of Item Created": "<Date Of Item Created>",
            "Modified By": "<Modified By>",
            "Date of Modification": "<Date of Modification>",
            "Pkey": "<Date of Modification>",
            "Delete_on": "<Delete_on>"
        },
        {
        .....
        },
        .....
    {
]

Error Handling:

  • Invalid Customer Key:
    If customer_key decoding fails, an error message with "Invalid Customer Key" is returned.
  • Database Connection/Execution Errors:
    Any issues during connection or query execution are caught, rolled back, logged, and returned with a 500 status.

Error Response Example:

{
    "status": "failed",
    "message": "Invalid Customer Key"
}
{
    "status": "failed",
    "message": {
        "error_type": "OperationalError",
        "message": "table does not exist"
    }
}

Security Considerations:

  • Sensitive data in the customer_key (like lscode and firmcode) is encoded to provide security.
  • The database is accessed only if the customer_key is valid and properly formatted.
get/api/new_mdm/column_list/

Headers

Customer-Keystring required
Table-Namestring required

Response

Successful Response

{"stackTrail":"paths:/api/new_mdm/column_list/:get:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}

Changes

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