TransWikia.com

magento2 rest API url, change API url

Magento Asked on December 12, 2021

<route url="/V1/api/orders/:id" method="GET">
        <service class="LovatApiApiOrdersRepositoryInterface"
                 method="get"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route>

i create an API, and everything works well, but i i would like to change url API
now URL looks like that http://localhost/rest/all/V1/api/orders/2

how can i edit url to http://localhost/api/V1/orders/2

One Answer

I think the easiest way will be to create a rewrite rule and let it do the job. Refer to this lijnk for creating a rule in Apache - https://httpd.apache.org/docs/trunk/rewrite/remapping.html

If using Nginx then you can also search for it about how to rewrite the url. This way you don't have to change much of the code.

Answered by Arif Ahmad on December 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP