Data Insertion main and reference tables through POST call receives error


#1

My body is this

{
“resource”: [
{
“queueId”:24,
“QueueName”: “queueName11”,
“IsIncluded”: true,
“users”: "test@test.com",
“holdtime”: 234,
“groupby”: “1”,
“queue_fields_by_queueId”: [
{
“fieldId”: 3,
“leftcriteria”: “in”,
“rightcriteria”: “not in”,
“leftvalue”: “ABC-PQR”,
“rightvalue”: “PQR-ABC”
}
],
“queue_fields_sort_by_queueid”: [
{
“fieldId”: 3,
“sort”: “desc”
}
]
}
]
}

Response is this

{
“error”: {
“context”: null,
“message”: “The queue id can not be empty.”,
“code”: 400,
“trace”: [
“0 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-sqldb/src/Resources/Table.php(860): DreamFactory\Core\SqlDb\Resources\Table->assignManyToOne(Object(DreamFactory\Core\Database\Schema\TableSchema), Array, Object(DreamFactory\Core\Database\Schema\RelationSchema), Array, false)”,
“1 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-sqldb/src/Resources/Table.php(2046): DreamFactory\Core\SqlDb\Resources\Table->updatePostRelations(‘queue’, Array, Array, false)”,
“2 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Resources/BaseDbTableResource.php(827): DreamFactory\Core\SqlDb\Resources\Table->addToTransaction(Array, 24, Array, false, false, true)”,
“3 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Resources/BaseDbTableResource.php(529): DreamFactory\Core\Resources\BaseDbTableResource->updateRecords(‘queue’, Array, Array)”,
“4 [internal function]: DreamFactory\Core\Resources\BaseDbTableResource->handlePUT()”,
“5 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(267): call_user_func(Array)”,
“6 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(173): DreamFactory\Core\Components\RestHandler->processRequest()”,
“7 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(220): DreamFactory\Core\Components\RestHandler->handleRequest(Object(DreamFactory\Core\Utility\ServiceRequest), ‘queue’)”,
“8 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Services/BaseDbService.php(117): DreamFactory\Core\Components\RestHandler->handleResource(Array)”,
“9 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(168): DreamFactory\Core\Services\BaseDbService->handleResource(Array)”,
“10 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Services/BaseRestService.php(74): DreamFactory\Core\Components\RestHandler->handleRequest(Object(DreamFactory\Core\Utility\ServiceRequest), ‘_table/queue’)”,
“11 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17036): DreamFactory\Core\Services\BaseRestService->handleRequest(Object(DreamFactory\Core\Utility\ServiceRequest), ‘_table/queue’)”,
“12 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17008): DreamFactory\Http\Controllers\RestController->handleService(‘v2’, ‘fstest’, ‘_table/queue’)”,
“13 [internal function]: DreamFactory\Http\Controllers\RestController->handlePOST(‘v2’, ‘fstest’, ‘_table/queue’)”,
“14 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9093): call_user_func_array(Array, Array)”,
“15 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9155): Illuminate\Routing\Controller->callAction(‘handlePOST’, Array)”,
“16 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9135): Illuminate\Routing\ControllerDispatcher->call(Object(DreamFactory\Http\Controllers\RestController), Object(Illuminate\Routing\Route), ‘handlePOST’)”,
“17 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“18 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“19 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17209): Illuminate\Routing\Pipeline->Illuminate\Routing\{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(9627): 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/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“24 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“25 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9612): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“26 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9136): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,
“27 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9123): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(DreamFactory\Http\Controllers\RestController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), ‘handlePOST’)”,
“28 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8191): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), ‘DreamFactory\\Ht…’, ‘handlePOST’)”,
“29 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(8178): Illuminate\Routing\Route->runController(Object(Illuminate\Http\Request))”,
“30 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7892): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))”,
“31 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“32 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“33 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“34 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9612): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“35 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7893): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,
“36 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7884): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))”,
“37 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(7874): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))”,
“38 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2416): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))”,
“39 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))”,
“40 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“41 /opt/bitnami/apps/dreamfactory/htdocs/app/Http/Middleware/AuthCheck.php(178): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“42 [internal function]: DreamFactory\Http\Middleware\AuthCheck->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“43 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)”,
“44 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“45 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“46 /opt/bitnami/apps/dreamfactory/htdocs/vendor/barryvdh/laravel-cors/src/HandleCors.php(34): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“47 [internal function]: Barryvdh\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“48 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)”,
“49 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“50 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“51 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(17306): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“52 [internal function]: DreamFactory\Http\Middleware\FirstUserCheck->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“53 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)”,
“54 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“55 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“56 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(13076): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“57 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“58 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)”,
“59 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“60 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“61 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(11622): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“62 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“63 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)”,
“64 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“65 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“66 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(12815): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“67 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“68 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)”,
“69 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“70 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“71 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(12752): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“72 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“73 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)”,
“74 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“75 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“76 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(3271): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“77 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))”,
“78 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9627): call_user_func_array(Array, Array)”,
“79 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
“80 /opt/bitnami/apps/dreamfactory/htdocs/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“81 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
“82 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(9612): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,
“83 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2363): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,
“84 /opt/bitnami/apps/dreamfactory/htdocs/bootstrap/cache/compiled.php(2347): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))”,
“85 /opt/bitnami/apps/dreamfactory/htdocs/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))”,
“86 {main}”
]
}
}

DreamFactory version 2.0

Database is MySql

Don’t understand why it’s giving error .
Kindly Help and explain.


#2

@prateek.mishra can you provide some more information about the queueId data type? Is it auto-incremented?


#3

queueId datatype is int(11)
type is id
yes it is auto_incremented


#4

@prateek.mishra can you try inserting queueId not with the assumed auto incremented value of 24 but rather as follows:

{
“resource”: [
{
“queueId”:0,
“QueueName”: “queueName11”,
“IsIncluded”: true,
“users”: "test@test.com",
“holdtime”: 234,
“groupby”: “1”,
“queue_fields_by_queueId”: [
{
“fieldId”: 3,
“leftcriteria”: “in”,
“rightcriteria”: “not in”,
“leftvalue”: “ABC-PQR”,
“rightvalue”: “PQR-ABC”
}
],
“queue_fields_sort_by_queueid”: [
{
“fieldId”: 3,
“sort”: “desc”
}
]
}
]
}

Let me know how the API responds.


#5

Not working by queueId =0

next json data is also giving same error

{
“resource”: [
{

		"QueueName": "NewStpl",
		"IsIncluded": true,
		"users": "aziz@stpl.com",
		"holdtime": 234,
		"groupby": "1",
		"queue_fields_by_queueId": [
			{
				"fieldId": 3,
				"leftcriteria": "in",
				"rightcriteria": "not in",
				"leftvalue": "IFM-AP,IFM-PAC,IFM-AERO,IFM-AP,IFM-PAC,IFM-AERO",
				"rightvalue": "IFM-AP,IFM-PAC,IFM-DAV,IFM-AP,IFM-PAC,IFM-DAV"
			}
		],
		"queue_fields_sort_by_queueid": [
			{
				"fieldId": 3,
				"sort": "desc"
			}
		]
	}
]

}