Hi all
is there a way to change entry point ‘api/v2’ with another one?
For example I’d like to change from:
http:/example.com/api/v2/
to:
http:/example.com/myapi/v1/
is this easy to do?
Thank you,
Valentino
Hi all
is there a way to change entry point ‘api/v2’ with another one?
For example I’d like to change from:
http:/example.com/api/v2/
to:
http:/example.com/myapi/v1/
is this easy to do?
Thank you,
Valentino
Hi @vlauciani,
If you take a look in your .env file you are able to customize the url. https://cl.ly/ce7b250205ec
Best,
Kevin McGahey
I tried to change DF_API_ROUTE_PREFIX=myapi variable but dreamfactory doesn’t work any more; looking the log, it try always to find route like ‘/api/v2/system/environment’ and not ‘/myapi/v2/system/environment’.
Any idea?
Thank you,
@vlauciani
Did you clear the DF cache after changing the .env file?
cd into the dreamfactory root directory and enter: php artisan cache:clear into the command line.
Regards
Thomas
It doesn’t work.
My new entry point is:
# grep "DF_API_ROUTE_PREFIX" .env
DF_API_ROUTE_PREFIX=myapi
#
I run:
# php artisan cache:clear
# php artisan config:clear
# php artisan df:clear-file-cache
# php artisan route:clear
but in the Login page, when I insert email and password, the log reports:
dreamfactory_1 | 10.0.4.75 - - [30/Nov/2018:08:51:37 +0000] "POST /api/v2/user/session HTTP/1.1" 405 21
the route contains api
instead of myapi
; why?
Thank you
It works for me. Did you remove the hash “#” before “DF_API_ROUTE_PREFIX”?
yes
I think that the problem is the Login page; entering into the container and running the route:list
:
root@cc54f011d15a:/opt/bitnami/dreamfactory# php artisan route:list
+--------+--------------------------------+---------------------------------------+--------------------+--------------------------------------------------------------------------+-------------------------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+--------------------------------+---------------------------------------+--------------------+--------------------------------------------------------------------------+-------------------------------+
| | GET|HEAD | / | | DreamFactory\Http\Controllers\SplashController@index | web |
| | GET|HEAD | graphql | graphql.query | DreamFactory\Core\GraphQL\Http\Controllers\GraphQLController@query | df.auth_check,df.access_check |
| | POST | graphql | graphql.query.post | DreamFactory\Core\GraphQL\Http\Controllers\GraphQLController@query | df.auth_check,df.access_check |
| | GET|HEAD | myapi | | DreamFactory\Core\Http\Controllers\RestController@index | df.api |
| | GET|HEAD|POST|PUT|PATCH|DELETE | myapi/{service}/{resource?} | | DreamFactory\Core\Http\Controllers\RestController@handleService | df.api |
| | GET|HEAD | myapi/{version} | | DreamFactory\Core\Http\Controllers\RestController@index | df.api |
| | GET|HEAD|POST|PUT|PATCH|DELETE | myapi/{version}/{service}/{resource?} | | DreamFactory\Core\Http\Controllers\RestController@handleVersionedService | df.api |
| | GET|HEAD | setup | | DreamFactory\Http\Controllers\SplashController@createFirstUser | web |
| | POST | setup | | DreamFactory\Http\Controllers\SplashController@createFirstUser | web |
| | GET|HEAD | setup_db | | DreamFactory\Http\Controllers\SplashController@setupDb | web |
| | POST | setup_db | | DreamFactory\Http\Controllers\SplashController@setupDb | web |
| | GET|HEAD | status | | DreamFactory\Core\Http\Controllers\StatusController@index | df.cors |
| | GET|HEAD | {storage}/{path} | | DreamFactory\Core\File\Http\Controllers\StorageController@streamFile | df.cors |
+--------+--------------------------------+---------------------------------------+--------------------+--------------------------------------------------------------------------+-------------------------------+
root@cc54f011d15a:/opt/bitnami/dreamfactory#
the new routes are ok and, for example, requesting the url http://myhost/myapi
the result is a correct JSON.
The Login page, with the URL http://myhost/dreamfactory/dist/index.html#/login
calls:
dreamfactory_1 | 10.0.4.75 - - [30/Nov/2018:10:59:55 +0000] "POST /api/v2/user/session HTTP/1.1" 405 21
instead of:
"POST /myapi/v2/user/session HTTP/1.1"
You are right. I think this path is hardcoded. Have a look at ./apps/dreamfactory/htdocs/public/dreamfactory/app/scripts/app.js at line 124:
// Make prefix configurable
.constant(‘INSTANCE_API_PREFIX’, ‘/api/v2’)