Hot answers tagged

4

You just need to add App\Emulation instance in your model and define Area. In your case the area is AREA_FRONTEND. namespace YourPackage\YourModule\Model; class YourApifilename implements \YourPackage\YourModule\Api\YourApiClassName { protected $appEmulation; public function __construct( \Magento\Store\Model\App\Emulation $appEmulation ...


3

It is because you are currently in API area You need to emulate your area to frontend. Just emulate, and after getting image you need to revert back emulation by stop emulate. startEnvironmentEmulation($storeId, \Magento\Framework\App\Area::AREA_FRONTEND, true); and stopEnvironmentEmulation(); with Magento\Store\Model\App\Emulation instance


2

I call Google Map API for get Latitude and Longitute of the specific location parameter I used this code in controller public function execute() { $url ="https://maps.googleapis.com/maps/api/geocode/json?address=%27White+House,+Pennsylvania+Avenue+Northwest,+Washington,+DC,+United+States%27&sensor=true_or_false&key=...


1

You can use this one. protected $_productRepositoryFactory; public function __construct( \Magento\Catalog\Api\ProductRepositoryInterfaceFactory $productRepositoryFactory ) { $this->_productRepositoryFactory = $productRepositoryFactory; } And you can get image like this way. $product = $this->_productRepositoryFactory->create()->...


1

I also faced same issue my previous project. Please try with below code it will work for your issue and let me know if you need more help on this. protected $request; protected $formKey; public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Framework\Data\Form\FormKey $formKey, \Magento\Framework\App\Request\...


1

Api need for third party use. Suppose let take example : You are running any product website successfully.Now you want to make mob app for it so for you want to just pass your all product details there. so using api you can get the product details. likewise customers detail,sales details and many more... when we want POST,delete, in short CRUD operation ...


1

Method :GET URL: http://yourdomain/index.php/rest/store-code/V1/categories \ -H 'authorization: Bearer token--string--' \ for store grocery call api Method :GET URL: http://yourdomain/index.php/rest/grocery/V1/categories \ -H 'authorization: Bearer token--string--' \ for store fruit call api Method :GET URL: http://yourdomain/index.php/rest/...


Only top voted, non community-wiki answers of a minimum length are eligible