Find Routes File For Magento 2 Rest API

controllersmagento2routes

I have inherited a Magento 2 site, and I am trying to find the rest api that is handling the checkout.

The route is <magento_site>/rest/default/V1/<checkout _information>.
As is, i have found a benchmark.jmx file that has the route, but no related PHP controller.

Where would I look to find the related file(s)?

Best Answer

Checking doesn't have just 1 API, you need to implement no of APIs to complete your checkout process.

Let's just get one example. To generate a quote id you can use this:

[BaseUrl]index.php/rest/V1/carts/mine (POST)

The above API will work on the frontend token of a user

carts/mine or another API route will be found in vendor/magento/module-quote/etc/webapi.xml in the relevant module.
In this file, you will find the Interface link and method name, interface then implemented on a model, and all your API logic can be found on that model file.

Like interface : Magento\Quote\Api\CartManagementInterface and method createEmptyCartForCustomer

Hope this will help you find the right file of your required API.

Related Topic