Get list of products by ids
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Get list of products by ids
Hi,
I use "aimeos/aimeos-laravel": "~2020.07"
I can get product by id using this url: http://localhost/jsonapi/product?id=4
But I want to get several products with id 1,2,3,4
I try to build url like: id=1,2,3,4 or id=1&id=2&id=3 or id[1]=1&id[2]&id=[3]
But it didn't work.
Whether jsonapi provides such a possibility, because I did not find any information about it in the documentation
I use "aimeos/aimeos-laravel": "~2020.07"
I can get product by id using this url: http://localhost/jsonapi/product?id=4
But I want to get several products with id 1,2,3,4
I try to build url like: id=1,2,3,4 or id=1&id=2&id=3 or id[1]=1&id[2]&id=[3]
But it didn't work.
Whether jsonapi provides such a possibility, because I did not find any information about it in the documentation
Re: Get list of products by ids
Use the "filter" parameter and add:
https://aimeos.org/docs/Developers/Clie ... the_result
Code: Select all
filter[||][][product.id]=1&filter[||][][product.id]=2&...
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Get list of products by ids
Thank you for reply, but I got an error
"errors": [
{
"title": "Invalid operator \"product.id\""
}
]
This is my url: http://localhost/jsonapi/product?filter[||][][product.id]=1&filter[||][][product.id]=2
"errors": [
{
"title": "Invalid operator \"product.id\""
}
]
This is my url: http://localhost/jsonapi/product?filter[||][][product.id]=1&filter[||][][product.id]=2
Re: Get list of products by ids
Sorry, it must be:
Code: Select all
filter[||][][==][product.id]=1&filter[||][][==][product.id]=2&...
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Get list of products by ids
Thank you, unfortunately I tried this and got error:
"errors": [
{
"title": "Invalid operator \"0\""
}
]
My url: http://localhost/jsonapi/product?filter[||][][==][product.id]=1&filter[||][][==][product.id]=2
"errors": [
{
"title": "Invalid operator \"0\""
}
]
My url: http://localhost/jsonapi/product?filter[||][][==][product.id]=1&filter[||][][==][product.id]=2
Re: Get list of products by ids
Please keep in mind that "=" is a special character in URLs and you have to escape those chars. The correctly escaped URL is:
which is the same as above but correctly escaped.
Code: Select all
/jsonapi/product?filter%5B%7C%7C%5D%5B0%5D%5B%3D%3D%5D%5Bproduct.id%5D=1
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
