1

I would like to know is it possible to (call) specify multiple URLs in a single route webapi.xml ?

Ex:-

<?xml version="1.0"?>
    <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
        <route url="/V1/hello/test/" method="POST">
            <service class="Inchoo\Hello\Api\TestInterface" method="test"/>
            <resources>
                <resource ref="anonymous"/>
            </resources>
        </route>
    </routes>

1 Answer 1

2

We can define the same API url name, BUT with different methods and actions:

    <route url="/V1/hello/test/" method="POST">
        <service class="Inchoo\Hello\Api\TestInterface" method="test"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route>

    <route url="/V1/hello/test/" method="GET">
        <service class="Inchoo\Hello\Api\TestInterface" method="get"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route>
3

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.