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

  • you can use search criteria for the same, for updated_at param – Aditya Shah Sep 7 '18 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 '18 at 2:29
  • Are you sending token with request ? – Pawan Sep 12 '18 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 – SalesforceElearner Sep 12 '18 at 4:47
  • i'm sending the token with request @Pawan – SalesforceElearner Sep 17 '18 at 5:41
1

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

  • 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 – SalesforceElearner Sep 11 '18 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'
         ]
      ]
    ]
  ]
  • 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 – SalesforceElearner Sep 11 '18 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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