API Versioning Laravel
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- MohammadShahriariFard
- Posts: 3
- Joined: 18 Jul 2021, 06:49
API Versioning Laravel
Is there a way to versioning aimeos jsonapi & jsonadm?
currently, all web services working this way :
http://localhost:8000/jsonapi/attribute
The way I want is :
http://localhost:8000/jsonapi/v1/product
or :
http://localhost:8000/v1/jsonapi/product
I'm using the latest version of aimeos on Linux OS.
currently, all web services working this way :
http://localhost:8000/jsonapi/attribute
The way I want is :
http://localhost:8000/jsonapi/v1/product
or :
http://localhost:8000/v1/jsonapi/product
I'm using the latest version of aimeos on Linux OS.
Re: API Versioning Laravel
You can change the prefix for the jsonapi route in your ./config/shop.php:
https://github.com/aimeos/aimeos-larave ... op.php#L16
https://github.com/aimeos/aimeos-larave ... op.php#L16
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
- MohammadShahriariFard
- Posts: 3
- Joined: 18 Jul 2021, 06:49
Re: API Versioning Laravel
That was the easiest solution But it is not efficient at least in this case.aimeos wrote: ↑19 Jul 2021, 06:13 You can change the prefix for the jsonapi route in your ./config/shop.php:
https://github.com/aimeos/aimeos-larave ... op.php#L16
Because we may need several different versions, such as V1, V2, V3 in the future...
Should we create a separate extension for each version?
Should we add {version} parameter to the core route like below?
Code: Select all
Route::match( array( 'GET' ), '{version}/{resource}', array(
'as' => 'aimeos_shop_jsonapi_get',
'uses' => 'Aimeos\Shop\Controller\JsonapiController@getAction'
) )->where( ['site' => '[A-Za-z0-9\.\-]+'] );
Code: Select all
Route::match( array( 'GET' ), '{resource}', array(
'as' => 'aimeos_shop_jsonapi_get',
'uses' => 'Aimeos\Shop\Controller\JsonapiController@getAction'
) )->where( ['site' => '[A-Za-z0-9\.\-]+'] );
Considering that we need all versions because different parts of the project interact with all versions and we can not just have one version.
Re: API Versioning Laravel
We don't change the JSON REST API in an incompatible way and therefore, we don't need versioning.
If you want to have different versions, you can add routes for each version pointing to different controller actions where you can use different implementations.
If you want to have different versions, you can add routes for each version pointing to different controller actions where you can use different implementations.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star