Hi
I am exploring the option of using dreamfactory for some APIs that I want to publish .
I have created a service with connection to a mysql DB hosted on AWS and can see API docs auto generated. The GET methods are working fine and I can retrieve records from the table.
For a simple table with some fields related to user details, I am trying to create a DB entry using the POST method for function “createRecord()”. I am getting the following error
> {
> "error": {
> "context": null,
> "message": "Create record by identifier not currently supported.",
> "code": 400,
> "trace": [
> "0 [internal function]: DreamFactory\\Core\\Resources\\BaseDbTableResource->handlePost()",
> "1 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(271): call_user_func(Array)",
> "2 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(177): DreamFactory\\Core\\Components\\RestHandler->processRequest()",
> "3 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(224): DreamFactory\\Core\\Components\\RestHandler->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), 'ig_user/438')",
> "4 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Services/BaseDbService.php(116): DreamFactory\\Core\\Components\\RestHandler->handleResource(Array)",
> "5 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(172): DreamFactory\\Core\\Services\\BaseDbService->handleResource(Array)",
> "6 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Services/BaseRestService.php(65): DreamFactory\\Core\\Components\\RestHandler->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), '_table/ig_user/...')",
> "7 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Utility/ServiceHandler.php(57): DreamFactory\\Core\\Services\\BaseRestService->handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), '_table/ig_user/...')",
> "8 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17493): DreamFactory\\Core\\Utility\\ServiceHandler::processRequest('v2', 'instagoapp', '_table/ig_user/...')",
> "9 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17469): DreamFactory\\Http\\Controllers\\RestController->handleService('v2', 'instagoApp', '_table/ig_user/...')",
> "10 [internal function]: DreamFactory\\Http\\Controllers\\RestController->handlePOST('v2', 'instagoApp', '_table/ig_user/...')",
> "11 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8766): call_user_func_array(Array, Array)",
> "12 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8835): Illuminate\\Routing\\Controller->callAction('handlePOST', Array)",
> "13 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8815): Illuminate\\Routing\\ControllerDispatcher->call(Object(DreamFactory\\Http\\Controllers\\RestController), Object(Illuminate\\Routing\\Route), 'handlePOST')",
> "14 [internal function]: Illuminate\\Routing\\ControllerDispatcher->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
> "15 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9472): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
> "16 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17857): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "17 [internal function]: Dreamfactory\\Http\\Middleware\\Limits->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "18 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "19 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17752): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "20 [internal function]: DreamFactory\\Http\\Middleware\\AccessCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "21 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "22 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "23 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9454): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
> "24 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8816): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
> "25 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8801): Illuminate\\Routing\\ControllerDispatcher->callWithinStack(Object(DreamFactory\\Http\\Controllers\\RestController), Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'handlePOST')",
> "26 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7755): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request), 'DreamFactory\\\\Ht...', 'handlePOST')",
> "27 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7726): Illuminate\\Routing\\Route->runWithCustomDispatcher(Object(Illuminate\\Http\\Request))",
> "28 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7379): Illuminate\\Routing\\Route->run(Object(Illuminate\\Http\\Request))",
> "29 [internal function]: Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))",
> "30 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9472): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
> "31 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "32 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9454): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
> "33 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7380): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
> "34 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7368): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))",
> "35 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7353): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))",
> "36 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2262): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))",
> "37 [internal function]: Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))",
> "38 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9472): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
> "39 /opt/bitnami/apps/dreamfactory/htdocs/vendor/barryvdh/laravel-cors/src/HandleCors.php(43): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "40 [internal function]: Barryvdh\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "41 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "42 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17836): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "43 [internal function]: DreamFactory\\Http\\Middleware\\FirstUserCheck->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "44 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "45 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(12789): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "46 [internal function]: Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "47 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "48 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(11412): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "49 [internal function]: Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "50 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "51 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(12530): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "52 [internal function]: Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "53 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "54 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(12469): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "55 [internal function]: Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "56 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "57 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2936): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "58 [internal function]: Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))",
> "59 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9464): call_user_func_array(Array, Array)",
> "60 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
> "61 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9454): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
> "62 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2209): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
> "63 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2192): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))",
> "64 /opt/bitnami/apps/dreamfactory/htdocs/public/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))",
> "65 {main}"
> ]
> }
> }
I passed following parameters in the call
{
"id": 1,
"userid": 1,
"user_fname":"A" ,
"user_lname": "M",
"user_email": "A@B.COM",
"user_age": 32 ,
"user_gender": ,
"user_dob" : ,
"user_dp_id" :
}
and
id = 201
The API end point looks like
http://xyz.abc.com:80/api/v2/dbName/_table/ig_user/201
Any advise or pointers on how to get this sorted ?