OPTIONS return has no links
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
OPTIONS return has no links
Hi,
I have a TYPO3 11.5 setup with the latest stable Aimeos and want to experiment with the jsonapi. When using the OPTIONS method, the returned json does not contain any links:
Any idea what I am doing wrong?
I have a TYPO3 11.5 setup with the latest stable Aimeos and want to experiment with the jsonapi. When using the OPTIONS method, the returned json does not contain any links:
Code: Select all
# sh
curl -X OPTIONS "https://catalog.van-der-slice.com/jsonapi"
# json
{
"meta": {
"prefix": "ai",
"content-baseurl": "/uploads/tx_aimeos",
"locale": {
"locale.id": "1",
"pos": 0,
"site_id": 1,
"locale.currencyid": "EUR",
"locale.languageid": "en",
"locale.position": 0,
"locale.sitecode": "default",
"locale.siteid": "1.",
"locale.status": 1
},
"resources": {
"attribute": "",
"basket": "",
"catalog": "",
"customer": "",
"locale": "",
"order": "",
"product": "",
"review": "",
"site": "",
"service": "",
"stock": "",
"supplier": ""
}
}
}
Re: OPTIONS return has no links
Seems like the TYPO3 URIBuilder doesn't generate any links, maybe because the page ID isn't available.
Which Aimeos and TYPO3 versions do you use?
Which Aimeos and TYPO3 versions do you use?
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
Re: OPTIONS return has no links
Hi!
Thank you for your reply!
I use TYPO3 11.5.23 with the latest Aimeos Distribution on php 8.1.
Could subdomains be a problem?
Thank you for your reply!
I use TYPO3 11.5.23 with the latest Aimeos Distribution on php 8.1.
Could subdomains be a problem?
Re: OPTIONS return has no links
I keep having this problem with many installations. My host is allinkl. I install TYPO3 and the aimeos distro on subdomains, e.g.
https://content.van-der-slice.com/
But just does not deliver any links in the resources section of the returned JSON:
And on local ddev installations, the returned links are not "human readable", meaning the enhancedRoutes does not seem to work.
Please advise!?!?
https://content.van-der-slice.com/
But
Code: Select all
url -X OPTIONS "https://content.van-der-slice.com/jsonapi"
Code: Select all
{
"meta": {
"prefix": "ai",
"content-baseurl": "/uploads/tx_aimeos"
, "locale": {"locale.id":"1","pos":"0","site_id":"1","locale.currencyid":"EUR","locale.languageid":"en","locale.position":0,"locale.sitecode":"default","locale.siteid":"1.","locale.status":1}
, "resources": {"attribute":"","basket":"","catalog":"","customer":"","locale":"","order":"","product":"","review":"","site":"","service":"","stock":"","supplier":""}
}
}
Please advise!?!?
Re: OPTIONS return has no links
Subdomains are not a problem. Is exactly the same code base running fine locally?
Maybe your TYPO3 site configuration is not correct.
The JSON API URL are not passed to a TYPO3 route enhancer because:
- route enhancers don't work all the time
- you are not dealing with that URLs manually
Instead, your JS code adds the required parameters to the given URL from the OPTIONS request and the JS interpreter doesn't care about URL structures. Use the JS code described here in your own code:
https://aimeos.org/docs/latest/frontend ... parameters
Maybe your TYPO3 site configuration is not correct.
The JSON API URL are not passed to a TYPO3 route enhancer because:
- route enhancers don't work all the time
- you are not dealing with that URLs manually
Instead, your JS code adds the required parameters to the given URL from the OPTIONS request and the JS interpreter doesn't care about URL structures. Use the JS code described here in your own code:
https://aimeos.org/docs/latest/frontend ... parameters
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
Re: OPTIONS return has no links
As you should see in my post, I do not use any JS yet. Only curl to test whether calls to the API work.
The code I use at all-inkl and the one I use locally with ddev is the same. All I do is install TYPO3 11.5.23 and than the Aiemos distribution.
With the Aimeos Distribution Package, do I have to change things in the enhanced routers? The HTML generated templates work fine. But the JsonAPI does not. At least when it comes to having nice URLs.
The code I use at all-inkl and the one I use locally with ddev is the same. All I do is install TYPO3 11.5.23 and than the Aiemos distribution.
With the Aimeos Distribution Package, do I have to change things in the enhanced routers? The HTML generated templates work fine. But the JsonAPI does not. At least when it comes to having nice URLs.
Re: OPTIONS return has no links
On my all-inkl server, I installed a TYPo3 10 version and the aimeos distribution that can be installed with that version.
The distro itself works fine, all the urls are "nice" (human readable).
And also the "curl -X OPTIONS https://rowild.at/jsonapi" returns links this time (not as in the TYPO3 11 version). But those links are still not "beautiful":#
I wonder why? Do I have to change sth with the enhancedRoutes? I thought the distribution takes care of the proper configuration...
The distro itself works fine, all the urls are "nice" (human readable).
And also the "curl -X OPTIONS https://rowild.at/jsonapi" returns links this time (not as in the TYPO3 11 version). But those links are still not "beautiful":#
Code: Select all
{
"meta": {
"prefix": "ai",
"content-baseurl": "/uploads/tx_aimeos"
, "locale": {"locale.id":"1","pos":"0","locale.siteid":"1.","locale.languageid":"en","locale.currencyid":"EUR","locale.position":0,"locale.status":1}
, "resources": {"attribute":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=attribute","basket":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=basket","catalog":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=catalog","customer":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=customer","locale":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=locale","order":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=order","product":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=product","review":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=review","site":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=site","service":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=service","stock":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=stock","supplier":"\/jsonapi?ai%5Baction%5D=options&ai%5Bcontroller%5D=Jsonapi&ai%5Bresource%5D=supplier"}
}
}
Re: OPTIONS return has no links
As mentioned in my other post, I did try Aimeos with Laravel. There I DO get properly formed urls in the resources section of the json that curl returns:
{
"meta": {
"prefix": null,
"content-baseurl": ""
, "csrf": {
"name": "_token",
"value": "PZsrnCjzMqxNGEhNNTUnHAg9MYdepkPo85M9cuZa"
}
, "locale": {"locale.id":"1","pos":"0","site_id":"1","locale.currencyid":"EUR","locale.languageid":"en","locale.position":0,"locale.sitecode":"default","locale.siteid":"1.","locale.status":1}
, "resources": {"attribute":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/attribute","basket":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/basket","catalog":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/catalog","customer":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/customer","locale":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/locale","order":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/order","product":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/product","review":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/review","site":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/site","service":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/service","stock":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/stock","supplier":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/supplier"}
}
}
I really do not think that this is a problem that I cause. After all I am only following the installation instruction using the Aimeos Disstribution - which should work out of the box. Either all-inkl makes troubles (I doubt that, because other software packages like Shopware work totally fine, and I have many, many instances of TYPO3 with properly configured enhanced routes running on allinkl) or your TYPO3 scripts are not up-to-date. I kindly ask you to look into that. And I'd be happy to provide access to one of my allinkl instances.
{
"meta": {
"prefix": null,
"content-baseurl": ""
, "csrf": {
"name": "_token",
"value": "PZsrnCjzMqxNGEhNNTUnHAg9MYdepkPo85M9cuZa"
}
, "locale": {"locale.id":"1","pos":"0","site_id":"1","locale.currencyid":"EUR","locale.languageid":"en","locale.position":0,"locale.sitecode":"default","locale.siteid":"1.","locale.status":1}
, "resources": {"attribute":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/attribute","basket":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/basket","catalog":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/catalog","customer":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/customer","locale":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/locale","order":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/order","product":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/product","review":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/review","site":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/site","service":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/service","stock":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/stock","supplier":"https:\/\/aimeos-laravel.ddev.site\/jsonapi\/supplier"}
}
}
I really do not think that this is a problem that I cause. After all I am only following the installation instruction using the Aimeos Disstribution - which should work out of the box. Either all-inkl makes troubles (I doubt that, because other software packages like Shopware work totally fine, and I have many, many instances of TYPO3 with properly configured enhanced routes running on allinkl) or your TYPO3 scripts are not up-to-date. I kindly ask you to look into that. And I'd be happy to provide access to one of my allinkl instances.
Re: OPTIONS return has no links
You have to add you own routes like as described here:
https://aimeos.org/docs/2022.x/typo3/setup/#seo-urls
Add this to your site configuration in addition to the existing routes:
Code: Select all
- { routePath: '/jsonapi/{resource}', _controller: 'Jsonapi::index' }
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
Re: OPTIONS return has no links
Does the TYPO3 v11 setup in your local DDEV environment returns links in the JSON API OPTIONS response or not?
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