How to create custom (detailed) queries with the API?
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!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
How to create custom (detailed) queries with the API?
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)
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)
Re: How to create custom (detailed) queries with the API?
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.
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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: How to create custom (detailed) queries with the API?
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
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
Re: How to create custom (detailed) queries with the API?
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/Clie ... the_result
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/Clie ... the_result
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
