JSON REST API Modifications

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)
adityabanerjee
Posts: 32
Joined: 05 Oct 2019, 06:42

JSON REST API Modifications

Post by adityabanerjee » 14 May 2021, 18:48

I want to know if I have an api for the product ie http://aimeos.test/default/jsonapi/prod ... [offset]=1

and I want to make change in this particular api. How would I proceed with it? I am not able to find any documentation regarding making change in a particular json api endpoint.

I want to return this api response in random. I want to know how would I proceed to implement this in Aimeos?

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

Re: JSON REST API Modifications

Post by aimeos » 16 May 2021, 12:10

If you change the product API endpoint, it will ALWAYS return random results and this is certainly not what you want. Copy the product Factory and Stanard classes into a new "Random" directory of your own extension and and use your own product manager there instead to get the random results you want:
https://github.com/aimeos/ai-client-jso ... pi/Product

Afterwards, add your new "random" endpoint to your config so it will be available in the frontend:
https://github.com/aimeos/ai-client-jso ... nt.php#L12
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply