Magento2

Tags:

Updated:

6 minute read

Application configuration is an integral activity prior to the process of integration. If your choosen application is Magento 2, providing the API Path, User name and Password is essential for configuring the agent.

Here you will find the detailed description on how to configure the agents for the application of Magento 2, the Integration Techniques and the Troubleshooting issues.

Pre-requisites for Magento2 Configuration

Get the API Path

  1. Check into Magento2 account.
  2. As Magento is a cloud-based application, therefore it has an URL. The API Path is your - URL/index.php/rest/V1/
  3. For all Magento Activities, Template bar is required, therefore the API Path in this case should be.

API Path: - http://templatebar.com/Individual/soumi/magento1/index.php/rest/V1/

The Username and Password will be - Magento2 Login Username and Password.

Configure the Agent

To Know about Agent Configuration, Click here

Configure the Magento Application in the Agent

  1. The API Path, Username and Password is now generated.
  2. Next, configure On-Premise AEC Agent before Integrating and executing the Touchpoints in the Cloud Portal.
  3. Create and Publish Connection in the cloud portal.
  4. Update the Configuration in your On-Premise AEC Agent. You will find your Connection present in the agent.
  5. Move into the App Configurations window in your agent and configure the details.

Protip: Uncheck the Show in Sync Panel checkbox before proceeding with the App Configurations

  1. Enter details - API Path, User Name and Password.
  2. Click Validate and Save.

After validation, you will get the message Successfully Validated and Saved.

Steps to Configure Magento2 Credential in OP Agent with Access Token:

  1. In the App Configurational Panel of the agent, Click on the + button beside the app Magento2.

  2. You can view the fields for validating the Magento2 adapter. The following are the fields for validating the adapter.

    a. API Path: You need to provide the Base URL of your Magento2 store admin. Click Here to know about the API Path in Magento2.

    b. Username: You need to provide the Username of your Magento2 store.

    c. Password: You need to provide the Password of your Magento2 store.

    d. Integration Access Token: This the access token generated on your Magento 2.

magentoat1

  1. For generating the Integration Access token, login to the Magento2 Admin and Navigate to System > Extensions > Integration.

magentoat2

  1. Click on the Add New Integration button, in the Integration window.

magentoat3

  1. Provide the Name (name of integration) and your current store password in the respective field.

magentoat4

  1. Click on the API tab and choose the Resource Access. You can select either of the two options provided, ALL & Custom. Once the resource access is provided, click on the SAVE button.

    a. ALL: Selecting this will provide the access to all the resources of your Magento 2 platform.

    b. Custom: You can select only those resources for which you want to provide the resource access. You can select the modules from the tree provided below.

magentoat5

  1. On saving, you can view a list menu, where you can view the name of the configuration you provided. Click on the Activate button available in the list menu.

magentoat6

  1. Click on the Allow button to allow the generation of the tokens.

magentoat7

  1. You can view the generated tokens after clicking the allow button.

magentoat8

  1. Copy the generated Access Token and paste it in the OP Agent. Click on the SAVE button, followed by VALIDATE.

Note: It is mandatory to enable the checkbox for Integration Access Token, while validating the Provided Token.

magentoat9

Note: Working with Integration Access Token, you can skip providing the username and password as the token validates with the API link provided.

magentoat10

Following the above steps you can successfully validate your Magento2 adapter using Integration Access Token.

Troubleshooting

ISSUE 1:

Some of the basic troubleshooting issue happens due to improper validations or even if it is accurately validated, and if touchpoints do not sync, this basic issue resolves after removing the Temp and Cache files from the portal and from your system. Therefore, after clearing all this publish the touchpoints again along with Update Configuration on the agent.

For E.g. If the Source Application Not Found in the log file appears, the probable cause is due to the presence of the Temp and Cache Files.

ISSUE 2:

You have an API for Magento, but the API is not accessible from your server

  • Discuss how to check API from local server.
  • Discuss about firewall settings

ISSUE 3: Customer Address issue with sourcelib: SetCustomerAddressItems(addresses) - NAV-Magento2.

SetCustomerAddressItems(addresses) is creating an issue with customer address sync which has one address both as bill to and ship to set as default. Checking the SAP address push scenario, this function was developed. This function transforms extra node to push the address in ship to section of SAP. The structure is as below:

addresses

"default_shipping": true, "default_billing": true

After transform through sourcelib:SetCustomerAddressItems (addresses)

addresses

"default_shipping": false, "default_billing": true "default_shipping": true, "default_billing": true

This extra node is creating an issue in NAV with multiple Address Line which is not allowed and resulting in failure of the data.

Solution: - Simple mapping should be done. No need to call the method SetCustomerAddressItems(). This method is developed only for SAP B1

Protip: While working with SAP B1 Integrations, SAP Business One DI Server ON/OFF is needed to be done for proper syncing if any errors like the above one persists

Attributes and Actions

While defining a connect to a particular API endpoint in Magento, you require clear understanding about the data requirements and endpoint configurations. You can refer to this document to find all the endpoint details of your magento installation. To define the endpoint in APPSeCONNECT, you need Actions and Entities. Actions are specifically targetted for a particular endpoint while schema is the data needed to execute the API. Here are the list of some of the prepackaged API actions defined for you which you can easily plug and play while doing your integrations.

Endpoint Action Action Type Schema UI Help API Help
/customers/search customers/search Get Customer It will search customer from magento. You can specify filter criteria based on type of customer customer_type and /or created_at or updated_at fields. The API also supports limit filters. Click here Search Customers
customers/CustomerId/Password resetPasswordLinkToken GET Customer It Checks if the password reset token is valid or invalid CustomerResetPassword
guest-carts/cartId itemId PUT Guest-carts Add/Update the specified item in cart guest-carts/cartId
orders orders GET order Magento gives user the privelage to add Orders from the front end of the application as well as backend of the application.Login to Magento2.0 front end with the valid credentials of a contact person.Now select certain items and place an order as per requirement. After the order is successfully placed the order ID should be generated. This will get orders from Magento2 for posting in any destination application from the backend order
product POST.json POST product This will Create order in Magento 2 from Source Application product
stockItem PUT.json PUT stockItem This will update inventory in Magento2 from any source Application stockItem
Customers/isEmailAvailable isEmailAvailable POST Customer Check if given email is associated with a customer account in given website Customers/isEmailAvailable
guest-carts/cartId itemId DELETE Guest-carts To Remove items from the specified cart guest-carts/cartId

Protip: Working on SAP B1 and Magento 2 (B2C) needs a SAP B1 add-on and Magento B2C extension for its integration. Customers and Orders can be created and placed from the Front-End also. For Placing orders from front end, visit the E-Commerce store and follow the generic steps for placing orders and creating customers.

Comments