Magento 2 API: What is this?
Magento API is a framework which could provide you the ability to manage your ecommerce stores effectively. In today post, I would like to provide you several basic information about what is Magento 2 API.
Magento 2 API: What is this?
What is Magento 2 API
The Magento web API is a framework which provides users integrators and developers which are means to use web services to communicate with the Magento system. Following are some key features of this framework:
Both REST and SOAP are supported. In Magento 2, the web API coverages of REST and SOAP are the same.
- Three authentication types:
- Applications of third-party authenticate with OAuth 1.0a.
- Applications of Mobile authenticate using tokens.
- Authenticate Administrators and customers with login credentials.
The resources which all accounts and integrations have access to are assigned. To perform the request, the API framework will check if any call has the authorization.
With a few lines of xml, any Magento or third-party service can be configured as a web API. In order to configure a web API, XML elements and attributes need to be defined in a
webapi.xmlconfiguration file. Because if you did not define the service in a configuration file, it will not be exposed.
Currently, webhooks are not supported in this system as the framework is based on the CRUD (which is the acronym for creating, read, update, delete) and search model.
To conserve mobile bandwidth, web API responses’ field filtering is supported by the framework.
- To increase the effectiveness of the integration, a single web API call can be enabled to run multiple services at the same time. For example, in the Catalog where a web API call can create a product, if the
media_gallery_entriesobjects are included in your payload, then the product’s inventory and media will also be created in that API call.
What can Magento web APIs be used for
You can use the APIs to perform a wide array of tasks. Here are some examples:
- Generate a shopping app which can be a traditional one which user can download on a mobile device. Besides, an app which an employee uses to help customers make purchases on a showroom floor can also be created.
- Integrate with the backend systems of CRM or ERP like Salesforce or Xero.
- Integrate with a CMS. However, at the moment, it not support content tagging.
How to get started
To get started, firstly, you need to register a web service on Magento Admin. Here are the steps that you should to follow to enable web services:
Step 1: Create a web services user on Magento Admin
If the authentication that you are using is token-based, selecting
System > Permission > All Users > Add New User. With the two remaining authentications, creating the new user in the Admin is not needed.
Step 2: Create a new integration on Magento Admin
In order to create an integration, go to
System > Extensions > Integration > Add New Integration. Please make sure that the resources which the integration can access are restricted.
Step 3: Configure authentication
A REST or SOAP client can be used to configure authentication.
In conclusion, above I have just provided you all the information about what is Magento 2 API, what you can do with it, and how to get started. I hope these details are helpful for you. If you have further questions, feel free to leave a comment below.
Enjoyed the tutorial? Spread it to your friends!