6

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=...


5

Magento2 does not suggest to add stock info to listing Api a MSI add to 2.3 version. But if you want don't use MSI to your system then you can below solution 1.Create di.xml at your app/code/StackExchange/Magento Update ExtensionPool data of Magento\Catalog\Api\Data\ProductInterface and add stock_item data provider. <?xml version="1.0" encoding="UTF-8"...


5

By default Magento there is no API endpoints to get the version. Based on your needs, you can create new API class then inject ProductMetadataInterface or inject ProductMetadataInterface in existing class wherever needs. public function __construct( \Magento\Framework\App\ProductMetadataInterface $productMetadata ) { $this->productMetadata = $...


5

You need to use "search" instead of "searchs". It's typo and also you need to specify search criteria fields. Execute this below URL in your postman {baseurl}/rest/V1/cmsPage/search?searchCriteria[sortOrders][0][field]=identifier&searchCriteria[sortOrders][0][direction]=asc


4

You can try below: $order = $this->_objectManager->create('Magento\Sales\Model\Order')->load($orderId); $orderItems = $order->getAllItems(); If you need more details from order you can review below post. http://www.codextblog.com/code-snippet/get-order-information-from-order-id-in-magento-2/


3

You are accessing wrong URL. Please see the details below. Get all available options for product attribute Request Method : GET Request Link Syntax : <base_url>/rest/V1/products/attributes/<attribute_code>/options Request Link in your case : http://magengree/rest/V1/products/attributes/manufacturer/options Add new option for ...


3

Problem Summary: You have a PHP Array and you want to return it as a JSON Object. When you return your PHP Array, it gets converted to a JSON Array, which does not support non-sequential keys. So your keys get ignored and you end up with a sequential array of your values. Solution Summary: You need to return a PHP Object in order to have a JSON Object in ...


3

If I understand you correct you are posting json in the body Therefore have you tried this $this->getRequest()->getContent() Eg https://github.com/magento/magento2/blob/ddf42caaf25311f10b23b95a92746f99943e045e/app/code/Magento/Signifyd/Model/SignifydGateway/Response/WebhookRequest.php#L56


3

First read this below articles: https://store.fooman.co.nz/blog/an-introduction-to-extension-attributes.html https://devdocs.magento.com/guides/v2.3/extension-dev-guide/extension_attributes/adding-attributes.html If you want to add a field them you need to use extension_atttibutes Extension attribute gives the facility to add a new field to existing API ...


3

Request URL: http://localhost/magento/rest/en/V1/customers/55 Body : { "customer": { "id":55, "email": "test@gmail.com", "firstname": "firstname new", "lastname": "lastname new", "website_id": 1 } } Add here ID field to update existing customer, also add all required fiels in payload.


3

From my experience this kind of error is related to a recursive method that it calls upon itself in an infinite loop. I would suggest to check the newest changes made to the project or the latest modules installed.


3

protected $orderRepository; public function __construct( ... \Magento\Sales\Api\OrderRepositoryInterface $orderRepository, .... ) { .... $this->orderRepository = $orderRepository; .... } //and use in required method as: $order = $this->orderRepository->get($orderId); foreach ($order->getAllItems() as $item) { ...


3

hi Please try below code for generate Invoice programatically $orderId = 31; //order id for which want to create invoice $order = $this->_orderRepository->get($orderId); if($order->canInvoice()) { $itemsArray = ['80'=>2]; //here 80 is order item id and 2 is it's quantity to be invoice $...


3

The \Magento\Customer\Model\ResourceModel\Customer\Collection class has no method setWebsiteId. If you want to filter customer collection by website id you must set website_id as a filter field: /** @var \Magento\Customer\Model\ResourceModel\Customer\Collection $customerCollection */ $customer = $customerCollection->addFilter('website_id', $websiteId) ...


2

Your are using wrong filter for Search using REST endpoints condition_type type should be &searchCriteria[filterGroups][1][filters][0][conditionType]=in it gives the result of 0 record. So Used finset A value within a set of values form multiselect &searchCriteria[filterGroups][1][filters][0][conditionType]=finset


2

You can easily implement global inventory management in Magento 2.3 and your inventory can be synchronized from various sales channels. MSI offers excellent support to the merchants controlling their single or multi-channel inventories and sales channels. It is designed especially for Magento store owners facilitate in managing their multi sources of ...


2

First get admin token, $adminUrl='http:Yourlurl/rest/V1/integration/admin/token'; $ch = curl_init(); $data = array("username" => "admin_username", "password" => "admin_password"); $dataString = json_encode($data); $ch = curl_init($adminUrl); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString); curl_setopt(...


2

Please try the following code public function getCategoryFilter($id) { $resultJson = $this->_resultJsonFactory->create(); $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $filterableAttributes = $objectManager->getInstance()->get(\Magento\Catalog\Model\Layer\Category\FilterableAttributeList::class); $...


2

I created module for that, You can follow this steps for that : Step 1 : Create registration.php file at app/code/RH/OrderStatus <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'RH_OrderStatus', __DIR__ ); Step 2 : Create module.xml file at app/code/RH/OrderStatus/etc ...


2

Try this http://localhost/test/rest/V1/products? searchCriteria[filter_groups][0][filters][0][field]=created_at& searchCriteria[filter_groups][0][filters][0][condition_type]=from& searchCriteria[filter_groups][0][filters][0][value]=2019-07-22 00:00:00& searchCriteria[filter_groups][1][filters][0][field]=created_at& searchCriteria[...


2

I solved editing /vendor/magento/module-customer/etc/webapi.xml <route url="/V1/customers" method="POST"> <service class="Magento\Customer\Api\AccountManagementInterface" method="createAccount"/> <resources> <!-- resource ref="anonymous"/ --> <resource ref="self"/> </resources> </route> ...


2

We need to pass the instance of CustomerSearchResultsInterface, not the interface. \Magento\Framework\Api\SearchResults is the instance of the interface. But, it's safe if you don't set the instance of $result. Changes your plugin: public function afterGetList(CustomerRepository $subject, \Magento\Framework\Api\SearchResults $results) { ...... } Or ...


2

Simply change the status of your product to disabled through Rest Api. That will make in hidden from appearing in website. Hope it finds you helpful.


2

As I know, I think there are no any core magento API provide data of sort by option list. So, we need to create custom API for that. Follow this below steps for that : Step 1 : create registration.php file at app/code/RH/CustomAPI/registration.php <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ \...


2

You can get product stock status from here : /V1/stockItems/:productSku API Response : { "item_id": 1, "product_id": 1, "stock_id": 1, "qty": 100, "is_in_stock": true, "is_qty_decimal": false, "show_default_notification_message": false, "use_config_min_qty": true, "min_qty": 0, "use_config_min_sale_qty": 1, "...


2

Summary of the proposed solutions. 1) From @sathish answer - I've created my own REST API. You can check the following commit or simply use extension. 2) From @renga comment, it is possible to get Magento version from www.website.com/magento_version. So I used the following code to get the Magento version in my React Native app. const getMagentoVersion = ...


2

You can follow below solution to achieve this. Vendor\Module\etc\extension_attributes.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd"> <extension_attributes for="Magento\Quote\Api\Data\CartItemInterface"> ...


2

no , the paths are like for interface and model should be like : app\code\EternalParquet\ProductByEbayItemid\Api\ProductByEbayItemidInterface and app\code\EternalParquet\ProductByEbayItemid\Model\ProductByEbayItemidQuery. you should specify parameters before the function /** * Returns greeting message to user * * @api * @param mixed $...


2

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\...


2

Please remove generated directory and run below command once to fix type error occurred when creating object error php bin/magento setup:upgrade php bin/magento cache:clean php bin/magento cache:flush Hope this will help you!


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