Jsonapi Typo3 Endpoint/ Search Products

How to configure and adapt Aimeos based shops as developer
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!
User avatar
mefailing
Posts: 7
Joined: 15 Feb 2022, 14:15

Jsonapi Typo3 Endpoint/ Search Products

Post by mefailing » 15 Feb 2022, 14:18

Hello,

we use an Aimeos store in Typo3. We would like to add a search function to the website. How is this possible?

We wanted to search for products via jsonapi, however we can not find the correct endpoint/ url path. "/jsonapi" returns 404 not found. What is the correct address for Typo 3?

Thanks a lot for the help.

(Version 18.10/ Windows)

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Jsonapi Typo3 Endpoint/ Search Products

Post by aimeos » 16 Feb 2022, 13:45

The JSON API endpoint depends on the TYPO3 URL of the "jsonapi" page in the page tree. If it's "Shop > jsonapi", then your URL should be "/shop/jsonapi".

Please note that Aimeos 18.10 is gets bugfixes and security fixes within the ELTS package:
https://aimeos.com/support#c428

The other option is to upgrade to 21.10 LTS to be on the save side.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
mefailing
Posts: 7
Joined: 15 Feb 2022, 14:15

Re: Jsonapi Typo3 Endpoint/ Search Products

Post by mefailing » 23 Feb 2022, 10:06

Thank you very much for the quick reply, that helped a lot.

The URL we got back via OPTIONS works fine.
However, as soon as a filter is added, we get a "404 Page not found" error.
We have tried a few different filters, but always get a 404 error.

Url without Filter:
/shop/json-api?ai[action]=options&ai[controller]=Jsonapi&ai[resource]=product&cHash=1487183df0c22c27b95b6a6ed721e574

URl with Filter:
/shop/json-api?ai[action]=options&ai[controller]=Jsonapi&ai[resource]=product&cHash=1487183df0c22c27b95b6a6ed721e574&ai[filter][>][product.type]=select

Code: Select all

var url = '/shop/json-api'; // Base URL from config

var promise = $.ajax( url, {
    method: "OPTIONS",
    dataType: "json"
});

promise.done( function( options ) {
    var args = {
    'filter': {
      '>': {'product.type': 'select'}
    }
  };
  var params = {};

  if(options.meta.prefix) { // returned from OPTIONS call
      params[options.meta.prefix] = args;
  } else {
      params = args;
  }

  $.ajax({
      method: "GET",
      dataType: "json",
      url: options.meta.resources['product'], // returned from OPTIONS call
      data: params
  }).done( function( result ) {
      console.log( result.data );
  });
});

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Jsonapi Typo3 Endpoint/ Search Products

Post by aimeos » 24 Feb 2022, 07:22

Maybe the cHash is the problem. Does it work if you remove it from the URL?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply