how can i find the jsonadmin endpoint in typo3
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
how can i find the jsonadmin endpoint in typo3
Hi.
I'm writing a typo3 extension (fe plugin) and need access to the jsonadmin REST API to add/update/delete products. It seems to be a good idea to use the admin jsonapi to do that rather then accessing the database directly. I studied the following guide https://aimeos.org/docs/Developers/Admin/JSONAPI but i have no idea how to find the endpoint. I searched all the configs I know, but could't find anything usable. Has anyone ha solution or hint for me?
Kind regards, Michael
I'm writing a typo3 extension (fe plugin) and need access to the jsonadmin REST API to add/update/delete products. It seems to be a good idea to use the admin jsonapi to do that rather then accessing the database directly. I studied the following guide https://aimeos.org/docs/Developers/Admin/JSONAPI but i have no idea how to find the endpoint. I searched all the configs I know, but could't find anything usable. Has anyone ha solution or hint for me?
Kind regards, Michael
Last edited by frimi on 07 Oct 2020, 15:34, edited 1 time in total.
Re: how can i find the jsonadmin endpoint in typo3
The jsonadm endpoint is only available for backend modules because it requires a backend user to be logged in.
Instead, you should use the Aimeos managers to manipulate the data (and not directly accessing the DB as you've stated correctly). Here you can find the docs how to use them in your own extension:
https://aimeos.org/docs/2020.x/typo3/extend/
Instead, you should use the Aimeos managers to manipulate the data (and not directly accessing the DB as you've stated correctly). Here you can find the docs how to use them in your own extension:
https://aimeos.org/docs/2020.x/typo3/extend/
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: how can i find the jsonadmin endpoint in typo3
Many thanks für this Hint! I'll make a test how it match my needs. To implement my requirements, a BE module will also work, if this is nescessary to access the JSON admin API. If I take this way, how can I find the API endpoint in the Typo3 Backend?
Last edited by frimi on 08 Oct 2020, 17:34, edited 1 time in total.
Re: how can i find the jsonadmin endpoint in typo3
The URL is:
http://localhost/typo3/index.php?route= ... n%5D=index
You can use an OPTIONS request to get the available resources and also the token you need to perform any updates.
http://localhost/typo3/index.php?route= ... n%5D=index
You can use an OPTIONS request to get the available resources and also the token you need to perform any updates.
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: how can i find the jsonadmin endpoint in typo3
I'm trying to use the way described in https://aimeos.org/docs/2020.x/typo3/extend/ but it won't work as espected
My Code (in an Controller Action of my plugin):
Product Id 8 is defind in the database, is enabled and has a category assigned to it and is visible in the frontend/website
My Code (in an Controller Action of my plugin):
Code: Select all
$localConfigArray = array();
$config = \Aimeos\Aimeos\Base::getConfig( $localConfigArray );
$context = \Aimeos\Aimeos\Base::getContext( $config );
$localeMgr = \Aimeos\MShop::create( $context, 'locale' );
$localeItem = $localeMgr->createItem()->setLanguageId( 'de' );
$context->setLocale( $localeItem );
$productMgr = \Aimeos\MShop::create( $context, 'product' );
$item = $productMgr->getItem('8');
// => Result is :
// Item with ID "8" in "product.id" not found
// in .../httpdocs/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Manager/Base.php line 688
Re: how can i find the jsonadmin endpoint in typo3
Without using the boostrap() method described in the docs, there's no site ID available and you won't get any results:
Code: Select all
$manager = \Aimeos\MShop::create( $context, 'locale' );
$item = $manager->bootstrap( '<sitecode>', '<languageid>', '<currencyid>', true );
$context->setLocale( $item );
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: how can i find the jsonadmin endpoint in typo3
Oh cool, many thanks! Knowing to read is a underestimated skill....
Now it works and I can get the desired Item. I can now continue to explore the capabilities of the different manager objects to manage the Products and their attributes.
Kind regards, Michael
Now it works and I can get the desired Item. I can now continue to explore the capabilities of the different manager objects to manage the Products and their attributes.
Kind regards, Michael
Re: how can i find the jsonadmin endpoint in typo3
How can i get the backend token in javascript?
Re: how can i find the jsonadmin endpoint in typo3
It's part of the backend URL available in the data-url attribute here:
https://github.com/aimeos/ai-admin-jqad ... e.php#L132
https://github.com/aimeos/ai-admin-jqad ... e.php#L132
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