DEV Community

Cover image for 🚀Remove by query API in API Maker
API Maker®
API Maker®

Posted on • Edited on

🚀Remove by query API in API Maker

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

/api/schema/user-path/instance/database/table/query/delete
Enter fullscreen mode Exit fullscreen mode

Request Payload

{
    "find": {
        "first_name": "Bob"
    }
}
Enter fullscreen mode Exit fullscreen mode

$in with select, limit, deep

Request Payload

{
    "find": {
        "first_name": {
            "$in": [
                "Bob"
            ]
        }
    },
    "select": "name,description",
    "limit": 1,
    "deep": [
        {
            "s_key": "customer_id",
            "t_col": "products",
            "t_key": "owner_id"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

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

{
    "find": {
        "pincode": "382330"
    }
}
Enter fullscreen mode Exit fullscreen mode

'$nin' not in

Request Payload

{
    "find": {
        "first_name": {
            "$nin": [
                "Bob",
                "Alice"
            ]
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

$eq

Request Payload

{
    "find": {
        "customer_id": {
            "$eq": 19
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

$ne

Request Payload

{
    "find": {
        "customer_id": {
            "$ne": 19
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

$lt

Request Payload

{
    "find": {
        "customer_id": {
            "$lt": 19
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

$lte

Request Payload

{
    "find": {
        "customer_id": {
            "$lte": 19
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

$gt

Request Payload

{
    "find": {
        "customer_id": {
            "$gt": 19
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

$gte

Request Payload

{
    "find": {
        "customer_id": {
            "$gte": 19
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

$and

Request Payload

{
    "find": {
        "$and": [
            {
                "customer_id": {
                    "$lte": 15
                }
            },
            {
                "first_name": "Bob"
            }
        ]
    }
}
Enter fullscreen mode Exit fullscreen mode

$or

Request Payload

{
    "find": {
        "$or": [
            {
                "customer_id": 155
            },
            {
                "first_name": "Bob"
            }
        ]
    }
}
Enter fullscreen mode Exit fullscreen mode

To get more information about API Maker APIs please refer API Maker documentation.

API Maker 'remove by query' API documentation.

API Maker array operation API video.

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

Top comments (0)