0

How to create REST API which will fetch data from custom table?

Alex Paliarush
13.8k5 gold badges53 silver badges57 bronze badges
asked Jan 4, 2016 at 14:19
2
  • Which version of Magento? Commented Jan 4, 2016 at 22:23
  • could you pls explain how you get values from the table by using API Commented Jun 14, 2017 at 6:55

1 Answer 1

1
  1. Declare new service contract interface, see this
  2. In the model implementing this interface read data from custom table (via resource model)
  3. 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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.