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
- Check into Magento2 account.
- As Magento is a cloud-based application, therefore it has an URL. The API Path is your -
- 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
- The API Path, Username and Password is now generated.
- Next, configure On-Premise AEC Agent before Integrating and executing the Touchpoints in the Cloud Portal.
- Create and Publish Connection in the cloud portal.
- Update the Configuration in your On-Premise AEC Agent. You will find your Connection present in the agent.
- 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
- Enter details - API Path, User Name and Password.
- 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:
In the App Configurational Panel of the agent, Click on the + button beside the app Magento2.
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.
- For generating the Integration Access token, login to the Magento2 Admin and Navigate to
System > Extensions > Integration.
- Click on the
Add New Integration button, in the Integration window.
- Provide the Name (name of integration) and your current store password in the respective field.
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.
- 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.
- Click on the Allow button to allow the generation of the tokens.
- You can view the generated tokens after clicking the allow button.
- 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.
Note: Working with Integration Access Token, you can skip providing the username and password as the token validates with the API link provided.
Following the above steps you can successfully validate your Magento2 adapter using Integration Access Token.
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.
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:
After transform through sourcelib:SetCustomerAddressItems (addresses)
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
|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|
Custom Filter implementation for Data fetch using Magento2
API hits can be tammed using custom filters on its actions. You will be able to fetch specific data as per your filter. With APPSeCONNECT, you will have the option to implement custom
Action Filters that will enable you to fetch specific data as required. You need to implement your filter on three specific areas including the data filter. The filter should be provided as per the same syntax provided in the images:
1) Filter on Page Size: This is for implementing pagination for displaying maximum data on multiple pages as per your configuration.
The number of pages required for implementing the pagination needs to be provided in the field
2) Filter on Field: This is for implementing and fetching the data as per the API request. This implements the API request for Magento2. The configuration created_at needs to be given the field
3) Filter on Direction: This defines as how the data should be displayed in the bucket, Ascending or Descending. For ascending, you need to implement
asc in the field
value. For descending, you need to implement
desc in the field
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.