0

I need to get a link of this kindhttp://localhost/Magento2/rest I have a code by which I get base_url:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$baseUrl = $storeManager->getStore()->getBaseUrl

So i get http://localhost/Magento2/,but i need http://localhost/Magento2/rest.Help find a solution, please

0

I don't think this is available programmatically, but you can manually append 'index.php/rest/V1/' to the base URL as this should not ever change.

0

Try with Below solution:

/**
* @urlBuilder \Magento\Framework\UrlInterface
*/

$urlBuilder->getUrl("rest/*/V1/");  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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