How to create REST API which will fetch data from custom table?
 Alex Paliarush
 
 13.8k5 gold badges53 silver badges57 bronze badges
 
 - 
 Which version of Magento?benmarks– benmarks2016年01月04日 22:23:33 +00:00Commented Jan 4, 2016 at 22:23
- 
 could you pls explain how you get values from the table by using APIuser51361– user513612017年06月14日 06:55:41 +00:00Commented Jun 14, 2017 at 6:55
1 Answer 1
- Declare new service contract interface, see this
- In the model implementing this interface read data from custom table (via resource model)
- Expose created service contract interface as web API, see this
Also might be useful to look at any core APIs as an example (e.g. \Magento\Customer\Api\CustomerRepositoryInterface)
 answered Jan 4, 2016 at 17:40
 
 
 
 Alex Paliarush 
 
 13.8k5 gold badges53 silver badges57 bronze badges
 
 default