How can I get latest products as a REST API to display in mobile application home screen ?
Magento 2 – Get Latest Products REST API
apimagento2rest
apimagento2rest
How can I get latest products as a REST API to display in mobile application home screen ?
Best Answer
You can retrieve latest N products with the Magento 2 API or Repository
Use API call (from javascript widget):
And pass your search criteria as an argument.
The full request :
The documentation: http://devdocs.magento.com/guides/v2.1/howdoi/webapi/search-criteria.html
This prevents to manage the logic part which may change in the future Magento 2 release.
Use Repository in you template:
The complete code :
And use dependancy injection to avoid objectManager