Help with Json API - Filtering the product list
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!
Help with Json API - Filtering the product list
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
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
The right URLs are:ntnsapre wrote: 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?filte ... ]=mystring
https://localhost/jsonapi/product?filter[f_catid]=10
https://localhost/jsonapi/product?filter[f_attr][]=1
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: Help with Json API - Filtering the product list
Thanks for the quick response, one issue though -
The filter by attribute url gives me an error:
"title": "Invalid operator \"f_attr\""
The filter by attribute url gives me an error:
"title": "Invalid operator \"f_attr\""
Re: Help with Json API - Filtering the product list
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.
In the text it was correct but in the example URL it was wrong. Has been fixed.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 24
- Joined: 15 Mar 2018, 10:04
Re: Help with Json API - Filtering the product list
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?
Can you tell me what is the reason?
Re: Help with Json API - Filtering the product list
Can you post your code and a screenshot of your product attribute sub-panel in the admin interface?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 24
- Joined: 15 Mar 2018, 10:04
Re: Help with Json API - Filtering the product list
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
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?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 24
- Joined: 15 Mar 2018, 10:04
Re: Help with Json API - Filtering the product list
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
http://localhost/jsonapi/product?filter ... price,text
I am using this but did not get any success. It always filter only with attr_id