โ 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"
}]
});
Youtube video link
Websites
API Docs links
More Examples
https://docs.apimaker.dev/v1/examples/sys/db/saveSingleOrMultiple.html
https://docs.apimaker.dev/v1/examples/sys/db/gen/saveSingleOrMultipleGen.html
Follow on twitter
Linked In
https://www.linkedin.com/company/api-maker
Top comments (0)