Skip to content

API Maker - Save Single or Multiple API Records [Bulk Insert] [Post operation]

✅ This API is available in all major 8 database types in API Maker

  • MongoDB
  • MySQL
  • SQL Server
  • MariaDB
  • Oracle DB
  • PostgreSQL DB
  • TiDB
  • Percona XtraDB

✅ User can save single or multiple records

  • having some inbuilt validation and conversion functionality.

✅ Generate Dummy Payload [Single | Multiple]

  • Based on schema, user can generate dummy data with a single click by using Generated Data option in body section.
  • To generate your data it will not perform any kind of operation on database.it will guess the data based on field name and types.

✅ Modify response using Query Params [select | deep]

  • select - Retrieve the fields based on the user's needs.
  • deep - Obtain more precise / details data in a certain field.

✅ This API work like Atomic operation [either save all or none]

  • for single object inside the array, entire array input will not be considered as atomic operation.

⭐ Validation ⭐

👉 API Maker validate the payload using below validator.

  • required
  • email
  • max
  • maxLength
  • min
  • minLength
  • unique
  • validatorFun [Custom validator function]

⭐ Conversion ⭐

👉 API Maker can convert the payload using below conversion.

  • encryption
  • hashing
  • toLowerCase
  • toUpperCase
  • trim
  • trimStart
  • trimEnd
  • conversionFun [Custom conversion function]

⭐ API Example ⭐

[
    {
        "first_name": "Bob",
        "last_name": "Lin"
    },
    {
        "first_name": "Alice",
        "last_name": "Page"
    }
]

⭐ Example in code ⭐

// Perform bulk insert operation in schema based API
let saveSingleOrMultiple = await g.sys.db.saveSingleOrMultiple({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: [{
        "first_name": "Bob",
        "last_name": "Lin"
    },
        {
            "first_name": "Alice",
            "last_name": "Page"
        }]
});
// Perform bulk insert operation in generated API, only for mongoDB
let saveSingleOrMultiple = await g.sys.db.gen.saveSingleOrMultipleGen({
    instance: "mysql_8",
    database: "inventory",
    collection: "customers",
    saveData: [{
        "first_name": "Bob",
        "last_name": "Lin"
    },
        {
            "first_name": "Alice",
            "last_name": "Page"
        }]
});

NPM

YouTube

Websites

LinkedIn

Twitter