Accessing DF NONSQL SERVICe

Hi I did a fresh install of DF2 on plesk centos 6.5

everything in the install and config seems to be fine inclusing CORS setup and mongodb service

api docs generated fine as well and i am getting response there

but when i try to access it using either curl , or web request
passing all the required headers and parameter of api key and session

we have tried from linux mint , ubuntu 14.04 , mac book it’s all the same

then there are problems

mostly are 400 ,401 and 403 errors

can you please help us out as how can we test it
the examples for curls are the ones that i have used before but tailored it as per df2

curl -i -k -3 -X POST http://domain.com:80/api/v2/user/session?api_key=b6b108fcf3ea9cdecbc9ecb4ed7bce6250f74758d7753e73db58d60df936dcb1 -d ‘{“email":“753@xyz.sc”, “password":“123”}’

and as

curl http://753%40xyz.sc:123@domain.com:80/api/v2/user/session

even if i try to used postman (chrome extension for checking rest api)
it’s still giving me same problem

on a side note , it won’t allow user roles to be changed once done

thanks

4xx errors are about the client and if api-docs works fine I think you need to send some header information, like X-DreamFactory-application or something like that.

What’s the error message?

HTTP/1.1 403 Forbidden
Date: Thu, 19 Nov 2015 05:54:45 GMT
Server: Apache
Cache-Control: no-cache
X-Powered-By: PleskLin
Content-Length: 7051
Connection: close
Content-Type: application/json

{“error”:{“context”:null,“message”:“Access Forbidden.”,“code”:403,“trace”:[“0 [internal function]: DreamFactory\Http\Middleware\AccessCheck->handle(Object(Illuminate\Http\Request), Object(Closure))”,“1 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9545): call_user_func_array(Array, Array)”,“2 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“3 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9535): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,“4 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(8892): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,“5 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(8877): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(DreamFactory\Http\Controllers\RestController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), ‘handleGET’)”,“6 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(7831): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), ‘DreamFactory\\Ht…’, ‘handleGET’)”,“7 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(7802): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))”,“8 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(7455): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))”,“9 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,“10 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9553): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,“11 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“12 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9535): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,“13 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(7456): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,“14 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(7444): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))”,“15 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(7429): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))”,“16 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(2304): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))”,“17 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))”,“18 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9553): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,“19 /var/www/vhosts/luton.co/httpdocs/dreamfactory/vendor/barryvdh/laravel-cors/src/HandleCors.php(43): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“20 [internal function]: Barryvdh\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))”,“21 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9545): call_user_func_array(Array, Array)”,“22 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(17932): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“23 [internal function]: DreamFactory\Http\Middleware\FirstUserCheck->handle(Object(Illuminate\Http\Request), Object(Closure))”,“24 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9545): call_user_func_array(Array, Array)”,“25 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(12881): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“26 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))”,“27 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9545): call_user_func_array(Array, Array)”,“28 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(11504): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“29 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))”,“30 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9545): call_user_func_array(Array, Array)”,“31 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(12622): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“32 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))”,“33 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9545): call_user_func_array(Array, Array)”,“34 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(12561): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“35 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))”,“36 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9545): call_user_func_array(Array, Array)”,“37 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(2978): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“38 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))”,“39 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9545): call_user_func_array(Array, Array)”,“40 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,“41 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(9535): call_user_func(Object(Closure), Object(Illuminate\Http\Request))”,“42 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(2251): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,“43 /var/www/vhosts/luton.co/httpdocs/dreamfactory/bootstrap/cache/compiled.php(2234): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))”,“44 /var/www/vhosts/luton.co/httpdocs/dreamfactory/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))”,“45 {main}”]}}

Well,

403 Forbidden

The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

Are you sending head information? I’m pretty sure you need at least an api-key for DF2 with contain the key of the service.

See here:
https://wiki.dreamfactory.com/DreamFactory/Common-Headers-Parameters

  • HTTP Header - Add X-DreamFactory-API-Key: <your_api_key_here> header to each request sent to the instance.
  • HTTP Header - Add X-DreamFactory-Session-Token: <your_session_token_here> header to each request sent to the instance.
  • HTTP Header - Add Accept: application/json.