Help with Json API - Filtering the product list

How to configure and adapt Aimeos based shops as developer
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!
ntnsapre
Posts: 21
Joined: 16 Jan 2018, 20:31

Help with Json API - Filtering the product list

Post by ntnsapre » 16 Jan 2018, 20:43

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

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Help with Json API - Filtering the product list

Post by aimeos » 16 Jan 2018, 20:58

Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ntnsapre
Posts: 21
Joined: 16 Jan 2018, 20:31

Re: Help with Json API - Filtering the product list

Post by ntnsapre » 17 Jan 2018, 07:37

Thanks for the quick response, one issue though -

The filter by attribute url gives me an error:

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

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Help with Json API - Filtering the product list

Post by aimeos » 17 Jan 2018, 09:45

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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ntnsapre
Posts: 21
Joined: 16 Jan 2018, 20:31

Re: Help with Json API - Filtering the product list

Post by ntnsapre » 17 Jan 2018, 17:26

Thank you!

Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Re: Help with Json API - Filtering the product list

Post by Anshul Dua » 15 Mar 2018, 13:48

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?

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Help with Json API - Filtering the product list

Post by aimeos » 15 Mar 2018, 21:10

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, Image give us a star

Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Re: Help with Json API - Filtering the product list

Post by Anshul Dua » 16 Mar 2018, 06:17

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. :|

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Help with Json API - Filtering the product list

Post by aimeos » 16 Mar 2018, 09:03

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, Image give us a star

Anshul Dua
Posts: 24
Joined: 15 Mar 2018, 10:04

Re: Help with Json API - Filtering the product list

Post by Anshul Dua » 20 Mar 2018, 09:35

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

Post Reply