Hi Fam..
Background
With this route / handler, you are able to execute inserts in your database using parameterized sql command. You can also specify which fields should be returned from the record that was added. Copy the attached file to your pb_hooks directory and restart the app.
Example SQL Statement generated internally.
Usage
The path should contain the collection and the id you want to add. Predefined id are required to meet my use case
Give it the body to add and the fields (optional) to return.
Output
Background
With this route / handler, you are able to execute inserts in your database using parameterized sql command. You can also specify which fields should be returned from the record that was added. Copy the attached file to your pb_hooks directory and restart the app.
Example SQL Statement generated internally.
B4X:
INSERT INTO bma_course (name,startdate,enddate,manager,active,id,created,updated) VALUES ({:name},{:startdate},{:enddate},{:manager},{:active},{:id},{:created},{:updated})
Usage
The path should contain the collection and the id you want to add. Predefined id are required to meet my use case
B4X:
http://127.0.0.1:1001/api/rawinsert/bma_course/n1234567898
Give it the body to add and the fields (optional) to return.
B4X:
{
"record": {
"name": "Anele Testing Insert",
"startdate": "2025-01-01",
"enddate": "2025-12-31",
"manager": "123456",
"active": "true"
},
"fields": "id,name,manager"
}
Output
B4X:
{
"id": "n1234567898",
"manager": "123456",
"name": "Anele Testing Insert",
"success": true
}