🚀Remove by query API in API Maker
Tags: api, database, backend, automation
Published: 2023-09-22 11:38:23

Auto generated schema based 'Remove by query' API used POST request method. Here, give some examples and references.

### Sample data

| customer_id | first_name | last_name | last_update           | pincode | isActive |
|-------------|------------|-----------|-----------------------|---------|----------|
| 1           | Bob        | lin       | 2022-11-14 04: 34: 58 | 382345  | 1        |
| 2           | Alice      | Page      | 2022-10-15 02: 10: 40 | 382346  | 1        |
| 3           | Mallory    | Brown     | 2022-09-13 03: 44: 05 | 382347  | 1        |
| 4           | Eve        | Mathly    | 2022-11-12 01: 59: 33 | 382348  | 1        |
| 5           | Eve        | Page      | 2022-11-12 01: 59: 33 | 382349  | 1        |


URL
```text
/api/schema/user-path/instance/database/table/query/delete
```

Request Payload
```json
{
    "find": {
        "first_name": "Bob"
    }
}
```


### $in with select, limit, deep

Request Payload
```json
{
    "find": {
        "first_name": {
            "$in": [
                "Bob"
            ]
        }
    },
    "select": "name,description",
    "limit": 1,
    "deep": [
        {
            "s_key": "customer_id",
            "t_col": "products",
            "t_key": "owner_id"
        }
    ]
}
```

### string | number supports different datatype

- 'pincode' datatype is a number, but we pass it as a string in the payload. Yet, it will delete.

Request Payload
```json
{
    "find": {
        "pincode": "382330"
    }
}
```

### '$nin' not in

Request Payload
```json
{
    "find": {
        "first_name": {
            "$nin": [
                "Bob",
                "Alice"
            ]
        }
    }
}
```

### $eq

Request Payload
```json
{
    "find": {
        "customer_id": {
            "$eq": 19
        }
    }
}
```

### $ne

Request Payload
```json
{
    "find": {
        "customer_id": {
            "$ne": 19
        }
    }
}
```

### $lt

Request Payload
```json
{
    "find": {
        "customer_id": {
            "$lt": 19
        }
    }
}
```

### $lte

Request Payload
```json
{
    "find": {
        "customer_id": {
            "$lte": 19
        }
    }
}
```


### $gt

Request Payload
```json
{
    "find": {
        "customer_id": {
            "$gt": 19
        }
    }
}
```

### $gte

Request Payload
```json
{
    "find": {
        "customer_id": {
            "$gte": 19
        }
    }
}
```

### $and

Request Payload
```json
{
    "find": {
        "$and": [
            {
                "customer_id": {
                    "$lte": 15
                }
            },
            {
                "first_name": "Bob"
            }
        ]
    }
}
```

### $or

Request Payload
```json
{
    "find": {
        "$or": [
            {
                "customer_id": 155
            },
            {
                "first_name": "Bob"
            }
        ]
    }
}
```


To get more information about API Maker APIs please refer [API Maker documentation](https://docs.apimaker.dev/).

API Maker 'remove by query' API [documentation](https://docs.apimaker.dev/v1/docs/apis-all/schema-apis/auto-generated-schema-based-remove-by-query-api.html).

API Maker array operation API [video](https://youtu.be/ScgJjLqxTvU).

Websites
https://apimaker.dev

Register and experience API Maker
https://cloud.apimaker.dev

Follow on twitter
https://twitter.com/api_maker

Linked In
https://www.linkedin.com/company/api-maker

API Maker Youtube channel
https://www.youtube.com/@api_maker