Page 1 of 2

Help with Json API - Filtering the product list

Posted: 16 Jan 2018, 20:43
by ntnsapre
I've spent hours on this and I have a feeling I'm just doing it all wrong. How do I filter the list of products using the JSONAPI endpoint /jsonapi/product ? I specifically want to filter it by category and attributes.

Everything I try either returns ALL products, or returns name not valid. Here are a few things I've tried:

https://localhost/jsonapi/product?filter[=~][product.label]=mystring
https://localhost/jsonapi/product?filter[>][f_search]=mystring
https://localhost/jsonapi/product?filter[==][f_catid]=10
https://localhost/jsonapi/product?filter[==][product.f_attrid]=1
https://localhost/jsonapi/product?filter[==][attribute.code]=mystring


Aimeos version: 2017.10
PHP version: 7.1
Package: Laravel
Environment: Linux

Re: Help with Json API - Filtering the product list

Posted: 16 Jan 2018, 20:58
by aimeos

Re: Help with Json API - Filtering the product list

Posted: 17 Jan 2018, 07:37
by ntnsapre
Thanks for the quick response, one issue though -

The filter by attribute url gives me an error:

"title": "Invalid operator \"f_attr\""

Re: Help with Json API - Filtering the product list

Posted: 17 Jan 2018, 09:45
by aimeos
Sorry, it must be: https://localhost/jsonapi/product?filter[f_attrid][]=1
In the text it was correct but in the example URL it was wrong. Has been fixed.

Re: Help with Json API - Filtering the product list

Posted: 17 Jan 2018, 17:26
by ntnsapre
Thank you!

Re: Help with Json API - Filtering the product list

Posted: 15 Mar 2018, 13:48
by Anshul Dua
I created a attribute and add in a product characteristics and in options. But i am not able to search that particular product with that attribute id. If list the attribute is listing with product.
Can you tell me what is the reason?

Re: Help with Json API - Filtering the product list

Posted: 15 Mar 2018, 21:10
by aimeos
Can you post your code and a screenshot of your product attribute sub-panel in the admin interface?

Re: Help with Json API - Filtering the product list

Posted: 16 Mar 2018, 06:17
by Anshul Dua
I didn't do anything in the code. I am using Aimeos admin panel to add the attribute. I found one thing that when i added the attribute in the product characteristics. It doesn't reflect in mshop_index_attribute table. :|

Re: Help with Json API - Filtering the product list

Posted: 16 Mar 2018, 09:03
by aimeos
A screenshot of your product characteristic sub-panel for the product would be helpful. Did you add the product to a category so it gets indexed?

Re: Help with Json API - Filtering the product list

Posted: 20 Mar 2018, 09:35
by Anshul Dua
How can i filter using attribute and catalog id?
http://localhost/jsonapi/product?filter ... price,text
I am using this but did not get any success. It always filter only with attr_id