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)
#5732 by cecosd
22 Feb 2018, 20:03
Hello to everyone who reads this!
I have a specific issue/question or however you call it. :)

I have a VueJS front end where I make a portal for some of my customers to view their products/reviews/ yada yada...

I need to make a detailed queries for my products page.
Query needs to say:
Get all the products -> grab their attributes with texts -> grab the stock levels for each product -> images for each product -> and you get the idea...

I want to learn how to make such big API calls.

It will mean the world to me if someone helps me solfing this problem. And also I thing this will help people like me with such tasks.

Thanks in advance,
Tsvetan (Ted)
#5740 by aimeos
23 Feb 2018, 00:19
This only requires two API calls in the latest version: One for the product and related data and one for the stock levels

To include the related product data in the response of the JSON REST API, you need to add the "included" parameter:
https://aimeos.org/docs/Developers/Clie ... _resources

In your case the value for "included" would be "attribute,media,price,product,text". In the latest 2018.01 version, you will also get the related data of the attributes, media, prices and texts as well. In 2017.10 and before, you will have to fetch them separately with another API call for each resource.
#5761 by cecosd
25 Feb 2018, 19:48
Hey aimeos,
That was helpful! But here is a nex question.
It seem I can't get the stock levels for a product. I upgraded to 2018.01.

When I do the API call
jsonapi/stock?ai[filter][s_prodcode][==]=1
I can't get the stocklevel for all products.
I am missing something...
Thanks
#5770 by aimeos
26 Feb 2018, 23:23
Your filter parameter is wrong and you need something like this:

jsonapi/stock?ai[filter][==][s_prodcode]=abcd

If you need the "ai" prefix depends on if it's listed in the (OPTIONS) response.

The documentation for filtering is here:
https://aimeos.org/docs/Developers/Client/JSONAPI/Fetch_items#Filtering_the_result