I want to create a custom API to get all of the information of a product including stock details and order details.
I checked the existing product APIs but to get all of the information, need to run at least 3 APIs "/V1/products", "/V1/stockItems" and "/V1/orders".
I want the responses of these 3 APIs into a single API.
Solved! Go to Solution.
Hi @vartika_sharma,
I guess that you will need to build a custom endpoint but maybe is better to use the original ones and, base don the response, perform new calls.
If that isn't an option, as you can imagine, you could explore all those endpoints and try to call the methods inside your own and customized route.
If you need some guidance to satrt building your own API andpoint, maybe you can start here: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/service-contracts/service-to-web-service...
Hi @vartika_sharma,
I guess that you will need to build a custom endpoint but maybe is better to use the original ones and, base don the response, perform new calls.
If that isn't an option, as you can imagine, you could explore all those endpoints and try to call the methods inside your own and customized route.
If you need some guidance to satrt building your own API andpoint, maybe you can start here: https://devdocs.magento.com/guides/v2.3/extension-dev-guide/service-contracts/service-to-web-service...
According to your answer, I am trying to create a new API which calls the existing methods to get products data inside my custom method. But now I am facing another issue.
I wanted to accept multiple values of a parameter (comma separated)
eg. parameters
key value
id 1,2,3
Could you please help me with this.
Hi @vartika_sharma,
It seems the requirment starts to being complex faster.
Maybe you could check if the feature can be simplified to avoid an endpoint that could waste your resoruces.