2

How to get the products from magento 2 using REST API based on the updated_at criteria, so I can able to get products created/updated on particular date. how to achieve this task. please help me.

Thanks in advance...

6
  • you can use search criteria for the same, for updated_at param Sep 7, 2018 at 9:33
  • @Wisam answer seems to correct, However your error is related to OAuth. Please see devdocs.magento.com/guides/v2.2/get-started/authentication/…
    – Pawan
    Sep 12, 2018 at 2:29
  • Are you sending token with request ?
    – Pawan
    Sep 12, 2018 at 2:31
  • without filter criteria i'm able to get response. but when I include the filter criteria it says me invalid signature. @Pawan Sep 12, 2018 at 4:47
  • i'm sending the token with request @Pawan Sep 17, 2018 at 5:41

2 Answers 2

3

Try this

GET /V1/products?&searchCriteria[filter_groups][0][filters][0][field]=updated_at&searchCriteria[filter_groups][0][filters][0][value]=2018-09-07&searchCriteria[filter_groups][0][filters][0][condition_type]=gteq

This endpoint will give you all products that being updated after 2018-09-07 it is working for me, I hope it will help you

1
  • Thanks for the reply.. I have tried your answer in my apex controller, in the response I'm getting {"message":"Invalid signature"}. without filter criteria getting all the products in the response. can you guide me. where I have made mistake Sep 11, 2018 at 4:42
1

catalogProductRepositoryV1

you can use search Criteria

    http://<magento_host>/rest/V1/products/?
    searchCriteria[filter_groups][0][filters][0][field]=updated_at&
    searchCriteria[filter_groups][0][filters][0][value]=2018-09-17 00:00:00&
    searchCriteria[filter_groups][0][filters][0][condition_type]‌​=eq

method type : GET

The system creates an array, as shown in the following pseudo-code.

searchCriteria => [
  'filterGroups' => [
    0 => [
      'filters' => [
         0 => [
           'field' => 'updated_at',
           'value' => '2018-09-17 00:00:00',
           'condition_type' => 'eq'
         ]
      ]
    ]
  ]
2
  • Thanks for the reply.. I have tried your answer in my apex controller, in the response I'm getting {"message":"Invalid signature"}. without filter criteria i'm getting all the products in the response Sep 11, 2018 at 4:40
  • Does that return all a configurable products simple products if the configurable product or simple product has changed? Or would be only get the entity that has changed?
    – tank104
    Sep 13 at 1:53

Your Answer

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

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