Hi,
I am trying to POST to a service service. But it seems like I am doing something wrong with the BODY. This is the part of my code that do the post
-- Submit to webservice local json = require( "json" ) local mime = require( "mime" ) local function networkListener( event ) if ( event.isError ) then print( "Network error: ", event.response ) else print ( "RESPONSE: " .. event.response ) end end local body = { "resource": [ { "gpsspeed": "1", "gpsalt": "2" } ] } local headers = {} headers["X-DreamFactory-Api-Key"] = "36fda24fe5588fa4285ac6c6c111111111f706d05a88" headers["Authorization"] = "Basic dXNlckBleG1111111bTp5cHpBUWVtdjhtaXM=" local params = {} params.headers = headers params.body = body network.request( "http://103.16.62.88/api/v2/cstri-sitrap/\_table/cstri.sitrap", "POST", networkListener, params )
The error, the post response, I get is
RESPONSE: {"error":{"code":400,"context":null,"message":"No record(s) detected in request. Please make sure record(s) are wrapped in a 'resource' tag. Example: {"resource":[{"record":1},{"record":2}]}","trace":["0 [internal function]: DreamFactory\\Core\\Database\\Resources\\BaseDbTableResource-\>handlePost()","1 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(326): call\_user\_func(Array)","2 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(187): DreamFactory\\Core\\Components\\RestHandler-\>processRequest()","3 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(245): DreamFactory\\Core\\Components\\RestHandler-\>handleRequest(Object(DreamFactory\\Core\\Utility\\ServiceRequest), 'cstri.sitrap')","4 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-database/src/Services/BaseDbService.php(171):
Any ideas about this?