---
title: "Search"
method: POST
path: "/api/new_mdm/search"
tags: ["MDM NEW"]
---

# Search

`POST /api/new_mdm/search`

**Function**: `search`
**Type**: API Endpoint (POST)

**Purpose**:
This function searches for data in specified tables based on the provided search values. It first checks
if the table exists in the actual database. Depending on the presence of specific columns and values,
it queries the relevant data.

**URL**:
`POST /api/new_mdm/search`

**Parameters**:
- `request` (Request): The request object.
- `search_values` (SearchValues): An object containing the table and optional columns to search.
- `Customer_Key` (str, optional): A base64 encoded header string containing `lscode` and `firmcode`.

**Returns**:
- A JSON response indicating the success or failure of the operation.
- If successful, returns the queried data.
- If the Customer_Key is invalid or if the table is not found, it returns a failure message.

**Exceptions**:
- Handles exceptions during base64 decoding and database operations, returning an appropriate error message.

## Headers

- `Customer-Key` string, nullable

## Request body

- SearchValues
  - `table` string, required
  - `column` object, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi.md) · [All operations](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/leapsurgebi/leapsurgeapi/revisions/5a6b1464bfeb/schema)
