Page 1 of 1

JSON REST API Modifications

Posted: 14 May 2021, 18:48
by adityabanerjee
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?

Re: JSON REST API Modifications

Posted: 16 May 2021, 12:10
by aimeos
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