4

I am using this API to get products between given end_date

"http://localhost/test/rest/V1/products?searchCriteria[filter_groups][0][filters][0][field]=end_date&searchCriteria[filter_groups][0][filters][0][value]=2019-07-22 00:00:00&searchCriteria[filter_groups][0][filters][0][condition_type]=gteq&searchCriteria[filter_groups][0][filters][0][field]=end_date&searchCriteria[filter_groups][0][filters][0][value]=2019-07-22 00:00:00&searchCriteria[filter_groups][0][filters][0][condition_type]=lteq"

but it is not giving me correct response. I am getting response like this

"{
    "items": [],
    "search_criteria": {
        "filter_groups": [
            {
                "filters": [
                    {
                        "field": "end_date",
                        "value": "2019-07-22 00:00:00",
                        "condition_type": "lteq"
                    }
                ]
            }
        ]
    },
    "total_count": 0
}"

seems like API considering only last filter.

0

1 Answer 1

2

Try this

http://localhost/test/rest/V1/products?
searchCriteria[filter_groups][0][filters][0][field]=created_at&
searchCriteria[filter_groups][0][filters][0][condition_type]=from&
searchCriteria[filter_groups][0][filters][0][value]=2019-07-22 00:00:00&
searchCriteria[filter_groups][1][filters][0][field]=created_at&
searchCriteria[filter_groups][1][filters][0][condition_type]=to&
searchCriteria[filter_groups][1][filters][0][value]=2019-07-23 23:59:59

I hope this will help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.