Hot answers tagged

50

What is Progressive Web Apps ? Looks and behaves like a mobile app. Take advantage of native mobile device features, without requiring the end user to visit an app store, make a purchase and download it locally. Why PWA? Fast Secure (second last topic of answer) Responsive Cross-browser compatible Offline Mode (Check the last topic in the answer) Mobile “...


18

Namespace: Mastering\Itdesire 1.How to Create Module Mastering/Itdesire/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Mastering_Itdesire" setup_version="1.0.1"> <...


15

I am assuming that AppFactory\Core\Api\SettingInterface::get() is a REST endpoint. In that case in phpdoc comments you need to define what this will return. Magento REST handler will take that value and process it to remove all data that are unnecessary. What's left will be encoded into JSON so in javascript you can retrieve it as already proper JS hash and ...


13

Just run the below command in magento root directory, it will show that log file location. grep -r "Report ID: webapi-5c644d10f0e26" var/ Up to my mind it is in exception.log file and find the line with the content webapi-5c644d10f0e26 for the detailed report.


9

The problem was that $product = $this->productRepository->get($sku); gets a product for the default store. And if you want to disable it globally you need to pass $this->productRepository->get($sku, true/* edit mode */, 0/* global store*/, true/* force reload*/);


8

I used Magento\Framework\App\State::getAreaCode() to find if request is coming via SOAP / REST API. You can check the possible area codes in Magento\Framework\App\Area class.


6

The custom attribute mobile_number should be inside custom customer attribute data: { "customer": { "email": "person@email.net", "firstname": "First", "lastname": "Last", "storeId": 1, "websiteId": 1, "custom_attributes": [ { "attribute_code": "mobile_number", "value": "23456798" } ] }, "password": "...


6

PWA - Progressive Web Application are the generally web application which is user experiences the rich web. in way of : Reliable - load instantly and also available in offline mode. Fast - in a way of interaction where user are smoothly interact with it, and also without any scrolling or animation junks. Engaging - as denoted above both points if ...


6

Create a module Test_Mobileshop Please follow the below steps with the file paths 2.app/code/Test/Mobileshop/etc/webapi.xml <?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/wishlist/items" method="...


5

11.Custom Grid In admin as continued here exceeding length of file in above ans: Mastering/Itdesire/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Framework\Console\CommandList"> ...


5

I've also faced this problem, and as an alternative to the solution @Zefiryn proposed, I have worked around it by enclosing the return data in an array (or two). Please consider the example below. /** * My function * * @return */ public function myFunction() { $searchCriteria = $this->_searchCriteriaBuilder->addFilter('is_filterable_in_grid',...


4

For the most of cases I think you could leave the exception thrown. Trace option doesn't show in production mode.


4

Try following curl -X GET -g "http://127.0.0.1:32769/index.php/rest/V1/customers/search?searchCriteria[sortOrders][0][field]=email&searchCriteria[sortOrders][0][direction]=asc" -H "Authorization: Bearer token" Rest API reference http://devdocs.magento.com/swagger/index_20.html


4

For the API, you should read more: http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-token.html http://devdocs.magento.com/swagger/#/ For example, this below code will return the customer info: <?php $userData = ["username" => "customeruser@gmail.com", "password" => "123456"]; $ch = curl_init("http://magen2.loc/...


4

I would recommend to check (even as a trial option) solutions like: Blackfire.io NewRelic xdebug Those tools will show you exact traces and timing of each separate PHP Trace that is involved within any operation/transaction (not limited to API calls) For Database related bottlenecks - MySQL Slow Query Log can be enabled (*depends on MySQL Version used). ...


4

For that you need to make different route url for that specific API <!-- Category Product Links --> <route url="/V1/rbcategories/:categoryId/products" method="GET"> <service class="Magento\Catalog\Api\CategoryLinkManagementInterface" method="getAssignedProducts" /> <resources> <resource ref="...


4

Progressive means that the application loads along with any relevant data and assets, as a user navigates around your website. This results in an end-user experience with better speed, usability, offline operation and device integration. Web means that it’s written in the languages of the web (HTML, CSS, JavaScript). This allows you to create a site that ...


4

If you don't want to use the Magento Message Queues, you can just disable it. php bin/magento module:disable Magento_Amqp If you want to use it, you might modify your app/etc/env.php <?php return [ // ... 'cron_consumers_runner' => [ 'cron_run' => false, 'max_messages' => 1000, 'consumers' => [ 'async.operations.all', ]...


3

My question is what is the function of the <parameter name="customerId" force="true">%customer_id%</parameter> and how it work? Magento gets the customer data with passing anything except token value in API call. In between magento calls some API related controllers for the same vendor/magento/module-customer/etc/webapi.xml <route url="/...


3

Progressive Web Apps is the middle ground between installable mobile apps and websites. We expect to see more traffic on the internet from mobile devices than from desktops, by 2019. PWAs improve the look and feel of websites to increase conversion. PWAs Offer Fast, Frictionless, “App-Like” Experiences Driving More Traffic, Higher Conversions and ...


3

The interface you defined, Vendor\Module\Api\MyInterface, doesn't have a method named myMethod. Add one, clear your cache, and you should be good!


3

The session based authentication (with "self" permission) is only allowed to AJAX calls and not to browser requests due to security vulnerabilities.


3

In your request to the API, you can specify your requested response format using the HTTP header: Accept: application/xml Unfortunately the only 2 MIME types Magento supports currently are application/xml and application/json. The following 2 classes provide the renderer for these formats: Magento\Framework\Webapi\Rest\Response\Renderer\Json Magento\...


3

Serializing the object will most likely serialize the entire PHP Object. That's the reason why you end up with a massive file. You only want to log the payload from that request. I've wrote a module once that would log all API requests to the database for debugging purposes. The way I did it was with a plugin around the dispatch()-method of \Magento\Webapi\...


3

First you need to create webapi.xml under your custom module Vendor\Module\etc\ <route url="/V1/custom/:categoryId/products" method="GET"> <service class="Vendor\Module\Api\CategoryLinkManagementInterface" method="getAssignedProducts" /> <resources> <resource ref="self"/> </resources> </route> – Route ...


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


2

I finally manage to resolve this issue. After digging into the Magento core, I found that in the \Magento\Framework\Reflection\ExtensionAttributeProcessor::buildOutputDataArray method, Magento get the type of the extension object attribute (in my case : Vendor\MultipleDiscounts\Api\Data\DiscountOrderItemInterface[]). If type is array, then Magento will ...


2

Open the System > Extensions > Integrations Add New Integration Set the integration Name and other settings, then specify your Magento 2 back-end password in the Your Password field Switch to the API sidebar tab and select the resources which will be available to OAuth clients: Press the Save button. The integration will be saved and the ...


2

AFAIK, Core WebAPI Structure for both Magento 2 Commerce and Magento 2 open Source is same but Magento 2 Commerce is more optimized in terms of scalability, security. All the Modules that are available in both Magento 2 Commerce and Magento 2 open Source, have the Same API. As you can check using the below links: List of REST APIs for Magento Open ...


2

Web-based APIs (REST and SOAP) is fully improved in Magento 2. In M2, Using Service Contract API and web both are using the same functionality to access any resource. You can check Architectural diagrams to get more understanding about the flow. You can also check M2 overview of the Web API blog post. Some Major difference Between M1 API and M2 API: ...


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