Hot answers tagged

57 votes
Accepted

What is Progressive Web Apps, or PWAs in Magento 2?

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 ...
Aditya Shah's user avatar
  • 7,587
49 votes
Accepted

Magento2.2.5 How to access Magento Log file for Web API?

Just run the below command in magento root directory, it will show that log file location. grep -r "Report ID: webapi-5c644d10f0e26" var/ Note: Change the above report id as per your error ...
Bilal Usean's user avatar
  • 9,917
21 votes
Accepted

Magento 2: How to return a JSON object from the API?

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 ...
Zefiryn's user avatar
  • 5,878
19 votes
Accepted

How to create custom Module Development in magento 2 from Scratch?

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:...
Pramod Kharade's user avatar
18 votes

Consumer "async.operations.all" skipped as required connection "amqp" is not configured. Unknown connection name amqp

The answer from @Rafael Corrêa Gomes (and any to the point that mentions either 'cron_run' => false or 'consumers' => ['async.operations.all'] in the configuration are quite outrageous because ...
Danila Vershinin's user avatar
18 votes

Consumer "async.operations.all" skipped as required connection "amqp" is not configured. Unknown connection name amqp

Danila is above is right Solutions that tell you to do cron_run = 'false" will disable other queues you do want, like bulk attribute update or export file generation. Option 1 disable packages ...
iphigenie's user avatar
  • 1,679
15 votes
Accepted

How to disable/enable a product programatically in Magento2?

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-&...
awavi's user avatar
  • 989
11 votes
Accepted

How to add cutom customer attribute field to call rest api via create new customer

The custom attribute mobile_number should be inside custom customer attribute data: { "customer": { "email": "[email protected]", "firstname": "First", "lastname": "Last", "storeId": ...
Khoa TruongDinh's user avatar
10 votes
Accepted

Magento2: How to check if request is from Web Service?

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.
MagePsycho's user avatar
  • 4,712
8 votes

Magento 2: How to return a JSON object from the API?

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. /*...
pawitk's user avatar
  • 81
8 votes
Accepted

<parameter name="customerId" force="true"> in customer module webapi.xml

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 ...
Aditya Shah's user avatar
  • 7,587
8 votes
Accepted

Magento 2 : How to create custom webapi?

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\...
Muhammad Hasham's user avatar
7 votes

Magento 2: How to return a JSON object from the API?

I know this question is quite old, but there is one quite simple solution for this: You either need to replace the Json-Renderer Magento\Framework\Webapi\Rest\Response\Renderer\Json or you write a ...
codiga's user avatar
  • 312
7 votes

What is Progressive Web Apps, or PWAs in Magento 2?

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 ...
Himanshu's user avatar
  • 1,751
7 votes
Accepted

How get wishlist in Magento 2 Rest API?

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://...
Nagaraju Kasa's user avatar
6 votes
Accepted

How to override webapi.xml in custom module?

For that you need to make different route url for that specific API <!-- Category Product Links --> <route url="/V1/rbcategories/:categoryId/products" method="GET"> <...
Manthan Dave's user avatar
  • 9,796
6 votes
Accepted

Magento 2.3.3 Getting issue in custom module GraphQL

Try with below code. type StoreHolidayInfo { dates: holidayDates, days: String, details: [holidayDetails] } type holidayDates { repetitive: [String] @doc(description: "holiday id"), ...
Yash Shah's user avatar
  • 2,483
5 votes

How to create custom Module Development in magento 2 from Scratch?

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-...
Pramod Kharade's user avatar
5 votes
Accepted

Best practice for returning errors in WebApi

For the most of cases I think you could leave the exception thrown. Trace option doesn't show in production mode.
Nicholas Miller's user avatar
5 votes

Get list of ALL customers using REST API

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: ...
B G Kavinga's user avatar
  • 1,266
5 votes

Create product attribute with options in magento2 through rest API

Try the below API End Point. https://yourmagentohost.com/rest/V1/products/attributes/ Request Type POST Example Request JSON for creating product attribute with dropdown values. { "attribute": { ...
mydons's user avatar
  • 491
4 votes
Accepted

Magento 2 : Can the REST API return plain text?

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 ...
Danny Nimmo's user avatar
  • 1,243
4 votes
Accepted

Magento 2 Customer login and forgot Password using Rest API

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 ...
Khoa TruongDinh's user avatar
4 votes

How to override webapi.xml in custom module?

In addition to the accepted answer: the reason why merging your custom xml config over the existing one does not produce the desired effect is because ref is the idAttributefor <resource> nodes, ...
Francesco Salvi's user avatar
4 votes
Accepted

profile API call

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 ...
Piotr Siejczuk's user avatar
4 votes

What is Progressive Web Apps, or PWAs in Magento 2?

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, ...
Anshu Mishra's user avatar
  • 8,910
4 votes
Accepted

Magento 2 WebAPI json encode

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 ...
muhammedv's user avatar
  • 351
3 votes
Accepted

Magento 2: How can I store my original REST request in a file on the server?

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 ...
Giel Berkers's user avatar
  • 12.2k
3 votes
Accepted

"Undefined index: interface" error from Magento 2 swagger webapi

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!
Nathan Merrill's user avatar
3 votes

Magento 2 - Session based authentication doesn't work

The session based authentication (with "self" permission) is only allowed to AJAX calls and not to browser requests due to security vulnerabilities.
Nikolas's user avatar
  • 2,281

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