JsonAPI get all products from a supplier
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!
-
- Posts: 14
- Joined: 09 Jun 2021, 15:06
JsonAPI get all products from a supplier
Hello, our AIMEOS version is 2021.04 and we run PHP 7.4.3.
I've been using Aimeos pretty successfully, but I have ran into a roadblock. I need to make an API call to retrieve all products of a certain supplier.
If I want to retrieve a single product, I make this call:
"https://MYURL/admin/default/jsonadm/product?include=media,text,price&filter[||][][%3D%3D][product.id]=60"
And this works great. But, how do I do something like:
"https://MYURL/admin/default/jsonadm/product?include=media,text,price&filter[||][][%3D%3D][product.attributes.supplier.id]=12"?
Is there a way to do this?
I tried going around it by retrieving all the products of a certain supplier and then getting those products with:
"https://MYURL/admin/default/jsonadm/product?include=media,text,price&filter[||][][%3D%3D][product.id]=60&filter[||][][%3D%3D][product.id]=61&filter[||][][%3D%3D][product.id]=62&filter[||][][%3D%3D][product.id]=63&filter[||][][%3D%3D][product.id]=64&filter[||][][%3D%3D][product.id]=65&filter[||][][%3D%3D][product.id]=66"
But with this I reach the 2000 character max URL length pretty easily and it's just clunky.
Thanks for any suggestions!
I've been using Aimeos pretty successfully, but I have ran into a roadblock. I need to make an API call to retrieve all products of a certain supplier.
If I want to retrieve a single product, I make this call:
"https://MYURL/admin/default/jsonadm/product?include=media,text,price&filter[||][][%3D%3D][product.id]=60"
And this works great. But, how do I do something like:
"https://MYURL/admin/default/jsonadm/product?include=media,text,price&filter[||][][%3D%3D][product.attributes.supplier.id]=12"?
Is there a way to do this?
I tried going around it by retrieving all the products of a certain supplier and then getting those products with:
"https://MYURL/admin/default/jsonadm/product?include=media,text,price&filter[||][][%3D%3D][product.id]=60&filter[||][][%3D%3D][product.id]=61&filter[||][][%3D%3D][product.id]=62&filter[||][][%3D%3D][product.id]=63&filter[||][][%3D%3D][product.id]=64&filter[||][][%3D%3D][product.id]=65&filter[||][][%3D%3D][product.id]=66"
But with this I reach the 2000 character max URL length pretty easily and it's just clunky.
Thanks for any suggestions!
Re: JsonAPI get all products from a supplier
Aimeos 2021.04 isn't supported any more. Please upgrade at least to 2021.10.
In 2021.x, it's hard to get the products with a specific supplier attached in the admin JSON API (frontend works without problems if you use the "index" endpoint but that's not available in the admin backend).
In 2022.x, this got easy because suppliers are attached to products now (not products to suppliers like before) and you can query products with a supplier using:
In 2021.x, it's hard to get the products with a specific supplier attached in the admin JSON API (frontend works without problems if you use the "index" endpoint but that's not available in the admin backend).
In 2022.x, this got easy because suppliers are attached to products now (not products to suppliers like before) and you can query products with a supplier using:
Code: Select all
/admin/default/jsonadm/product?filter[!=][product:has("supplier","default",12)]=
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 14
- Joined: 09 Jun 2021, 15:06
Re: JsonAPI get all products from a supplier
Thank you very much for your response.
Would there be any risk in updating our Aimeos version? Like, did any database structure change? I have a pretty extensive custom API I made and I worry it will all break if there are any collumns removed or renamed etc.
Thanks again!
Would there be any risk in updating our Aimeos version? Like, did any database structure change? I have a pretty extensive custom API I made and I worry it will all break if there are any collumns removed or renamed etc.
Thanks again!
Re: JsonAPI get all products from a supplier
When migrating to 2022.10, there are some breaking changes you need to care about:
https://aimeos.org/docs/latest/changelog/2022.x/
Updating to 2021.10 shouldn't break anything but the frontend theme is different.
https://aimeos.org/docs/latest/changelog/2022.x/
Updating to 2021.10 shouldn't break anything but the frontend theme is different.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star