I already know the basic of API and its use, but in magento its confusing.(I am new in magento) if I am creating my module, I can get data from model/repository, that's means API is not required every time.

apart from that I check that only few folders have API folder in default magento, for example its in the magento-catalog, but not in magento-backend.

so what's the best example when we need Api in magento?

1 Answer 1


Api need for third party use.

Suppose let take example :

You are running any product website successfully.Now you want to make mob app for it so for you want to just pass your all product details there.

so using api you can get the product details.

likewise customers detail,sales details and many more...

when we want POST,delete, in short CRUD operation by third party we need API

Now Magento_Backend module doesn't have API folder.

It's anyway does make sense that we can share our admin details with anyone or they can change any thing in our module? - It's simply No. That's why we don't need to create api folder there.

And How to make APi in best way we have coding standard to best implementation for it is : "service contracts"

Your Answer

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

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