To call BC365 API, we need to call get token API, then use this token for other APIs.
This is get token API:
https://login.microsoftonline.com/xxx/oauth2/v2.0/token
And the payload will include client_id, scope, grant_type, client_secret
Then use token in response as Bearer token for main api, example with Item:
https://api.businesscentral.dynamics.com/v2.0/xxx/Sandbox/ODataV4/Company('aa')/Items
There will be a concern about API Method, if you want to update an existing Item in BC, we need to send PATCH method and include item_no in url:
https://api.businesscentral.dynamics.com/v2.0/xxx/Sandbox/ODataV4/Company('aa')/Items('Item Code')
All this can be configurable in AllSync with few steps:
Create new application "BC365"
Create new table for product master
Create the integration flow to send item to BC
To connect with SAP B1 API (Service Layer), we need to call login api to get token:
http://server:50001/b1s/v1/Login
Then can call main API to get data, example:
http://server:50001/b1s/v1/Items
also need to loop and get data for all pages, get data by last updated date/time
Here is how to configure in AllSync.
Create new SAPB1 application
Create a product table with fields you want
Define an integration flow to retrieve product master
Authentication:
Get Product:
Authentication Process
Perform a GET on https://{SERVERNAME}/v1/rest/auth In the response look in the HTTP header for the Auth-Nonce
Generate an Auth-Nonce-Response using the following calculation:
Perform a GET on https://{SERVERNAME}/v1/rest/auth?usr={USER}&pwd={PASSWORD} with both the Auth-Nonce and the Auth-Nonce-Response values in the header. Replace the {USER} and {PASSWORD} with actual values.
Read the Auth-Session value from the response. This is your session token and is used to identify your connection. It must be present in the header of all calls made for your session.
Perform a GET on https://{SERVERNAME}/v1/rest/sit?ws={WORKSTATIONNAME} to claim a seat. (Don't forget to add the Token to the request header from step 4.)
Main API to get Sales data: http://server/v1/rest/document?page_size=6&page_no=1&cols=*,item.*,tender.*&filter=(invoice_posted_date,ge,2021-10-24T00:00:00.000+00:00)
Where we need to send last run date-time and get all pages
This is how to configure in AllSync to automatic download sales data from PRISM:
Create new application PRISM
Create new sales table with fields we want to store data
Create an integration flow
Create a data mapper
AllSync introduces new feature for authentication list of API to be called.
Authorization:
Get Document:
Params:filter = (invoice_posted_date,ge,{{applicationConfigurations.as_salesOrder_lastRun | minus:28800 | date: '%Y-%m-%d %H:%M:%S'}})
page_no=<{i}>
page_size=3
User can refer details of API in this url:
https://open.lazada.com/apps/doc/api?path=%2Fauth%2Ftoken%2Fcreate
Basically it is oAuth2 API, user need to login and authorize 3rd party application to access their data.
Once it is authorized, 3rd party app can have authorization code returned on callback url, that's why need to setup callback api url in App Console.
Then 3rd party application will generate token and maintain token by calling refresh token API.
Order update on Lazada can be retrieved by webhook, Lazada will send order number to webhook api, then 3rd party can call get order details based on order number and using token above.
Authorization code will be also expired after certain period, so seller need to re-login again.
All can be configured in AllSync following steps:
Create new application LAZADA, and enable oAuth2 option
Configure url details for authorization, get token and refresh token
Configure webhook in App Console at Lazada app to receive order status
Configure data mapping in AllSync to get order detail from lazada
AllSync.IO has introduced a new feature to manage the lifespan of data. As a middleware system, AllSync may need to automatically delete data after a certain period for various reasons, including security, data cleanliness, cost savings, and performance optimization.
This feature includes an option in the Application Settings, allowing users to configure how long queue data or archived queue data is retained. Once the specified time expires, the older data is automatically deleted.
A similar setting is available for User-Defined Tables, enabling users to define how long the main data in a table should be retained before being automatically removed.
Enable Web API:
Store >> Configuration >> Services >> Magento Web API >>
Allow Anonymous Guest Access : No
Allow OAuth Access Tokens to be used as standalone Bearer tokens: Yes
Get Token:
URL: http://server/rest/V1/integration/admin/tokenMethod: POSTBody:
{
"username": "user",
"password": "123",
"device": " "
}
Response: token as text, need to remove double quote in response
Get Orders:
URL: http://server/rest/V1/orders?search
Method: GET
Auth Type: Bearer Token
Param:
searchCriteria[filterGroups][0][filters][0][condition_type]=from&searchCriteria[filterGroups][0][filters][0][field]=updated_at&searchCriteria[filterGroups][0][filters][0][value]=2024-1-04 10:00:00&searchCriteria[page_size]=100&searchCriteria[currentPage]=1
Get Items:
URL: http://server/rest/V1/products
Method: GETParam: searchCriteria[page_size]=70&searchCriteria[currentPage]=2Auth Type: Bearer Token
Get an item by sku:
UR: http://server/rest/V1/products/{sku}
Get customers:
URL: http://server/rest/V1/customers/search
Params: searchCriteria[filterGroups][0][filters][0][condition_type]=from&searchCriteria[filterGroups][0][filters][0][field]=updated_at&searchCriteria[filterGroups][0][filters][0][value]=2024-1-04 10:00:00&searchCriteria[page_size]=100&searchCriteria[currentPage]=1
When you create new field in AllSync, there is an option to enable formula:
Once it is enable, you can setup the formula in detail, examplesubTotal = price*orderQuantity+taxAmount-discountAmount
In case of a field from main table need to sum of value from child table:
subTotal= sum(as_details, price*orderQuantity+taxAmount-discountAmount)
In the scenario, we allow user can access to an object directly to add or update a record. Example, scan QR code to open url to allow customer register new member. This is to create new record
Another example, after complete a transaction, allow user to scan QR code on receipt to request for eInvoice, this is to update existing report.
Or customer can search the order detail if they have order no.
Url format will be:
Search:
https://web.allsync.io/object-form?objectKey=?&key=xxx
Update:
https://web.allsync.io/object-form?objectKey=xxx&key=xxx
Add
https://web.allsync.io/object-form?objectKey=&key=xxx
where the key is getting from User Defined Table:
provide email and password to generate key for url.
Allsync supports direct connector to database like MS-SQL, Oracle, MySQL, SAP Hana.
The connector will connect directly to database and execute the query from configuration to get the data, each record received will be a incoming queue to AllSync.
However there will be a challenge to manage the latest update data and first time to get all data.
1. Manage to get latest updated date by period
select * from table T0 with(nolock)
where (cast(T0.Updated_Date as date)- date '1970-01-01')* 60 * 60 * 24 - 7*60*60 >= {{lastRun}}
connector will store the last run time to database and fill to the query for next run
2. Manage to get huge data by pagingselect * from Table T0
join
(
select table_id from Table
order by table_idOFFSET (<{i}>)*200 ROWS FETCH next 200 ROWS ONLY
) T1 on T0.table_id=T1.table_id
connector will loop each page to variable <{i}> to get each page data.
Lookup a value on a table:
Template: {{ 'value' | dbLookup: 'table_name','field_name' }}
Example: find the record has product code Z0001
{ "product":{{ 'Z00001' | dbLookup: 'as_inventory','product_code' }}}
Subtract a string from letter
{{ 'string' | subtractRight: '-' }}
{{ 'string' | subtractLeft: '-' }}
Example:
{{ '12345-12' | subtractRight: '-' }} >> result: 12345
{{ '12345-12' | subtractLeft: '-' }} >> result: 12
Call multiple APIs to get response for mapping
"targetList": [ { "name":"prline", "method": "API", "api": { "url": "api url", "authenticationType": "Bearer", "token":"123", "method": "GET", "headers": { "Content-Type": "application/json", "tenantID": "657d0fa69ab9a5dba703f185" } } }
The data will be combined for mapping:{
"raw": from raw data,
"prline": from response of api
}
Get a field has comma
Template: jsonData['field_name']example: jsonData['@odata.context'] from json:
{
"@odata.context":"value"
}
jsonData['raw']['@odata.context'] from json:{
"raw":
{
"@odata.context":"value"
}
}
Loop the array in json
{% for item in data.items %}
"itemName": "{{item.name}}"
{% endfor %}
If else condition
{% if Vendor_Shipment_No != ''%} "Document_Type": "Purchase Order", {% else %} "Document_Type": "PO Creation", {% endif %}
Validation and throw error message
Use special field name: allsyncError
{% if store_code==null or store_code==''%} "allsyncError":"store_code is blank", {% endif %}
Last record in loop
{% for item in data.items %}
"itemName": "{{item.name}}"
{% if forloop.last == false %},{% endif %} {% endfor %}
{% endfor %}
Index in loop
{% for item in data.items %}
"sequence": {{forloop.index}}
{% endfor %}
Size of an array
{% if value.size>0 %} "Line_No":"{{value.first.Line_No}}" {% else %}
Convert timestamp to date string
"Posting_Date": "{{CREATED_DATE | date: "%Y-%m-%d"}}"
Convert datetime string to timestamp:
"order_date": {{created_at | date: '%s'}}
Minus, multiply:
"line_total": {{product.price | times: product.quantity | minus: product.total_discount}}
Encryption
{{ subject | sha256 }} : not able to decrypt
{{ subject | aesEncode: 'key 32 character' }} : method AES_GCM
Including a .p12 file in an API call is a common requirement when dealing with secure and authenticated interactions with services that mandate mutual SSL/TLS authentication. The .p12 file, also known as a PKCS #12 file, is a binary format for storing a certificate chain and private key securely. This file is often used for client authentication in various APIs, particularly in Google Cloud services and other enterprise-level integrations.
Here is a detailed guide on how to include a .p12 file in an API call.
1. Understanding the p12 File
A .p12 file contains:
Client Certificate: A public key certificate that verifies the identity of the client to the server.
Private Key: A private key that should be kept secure and is used to sign requests to prove the client's identity.
Intermediate Certificates: Additional certificates that help establish a chain of trust up to a root certificate.
2. Prerequisites
Before making API calls with a .p12 file, ensure you have:
The .p12 file provided by your service provider.
The password for the .p12 file (often provided alongside the file).
A library or tool that supports .p12 file usage.
3. Using the p12 File in API Calls
Convert your existing systems to Omni-channel business, reference one of case study here
First, you need to have allsync account, contact support@allsync.io to request for a test account, you will get tenant Id and API Token
1. Configure SMTP information on your tenant account
2. This is API detail to send email:
Url: https://api.allsync.io/Tenant/{tenant_id}/SendMail
Method: POST
Header:
tenantId = {tenant_id}
Authorization = Bearer Token
Token = {your tenant token}
Payload:
{
"subject": "Welcome to AllSync.IO",
"toEmails": [
"support@allsync.io"
],
"data": "data body"
}
Integration systems play a crucial role in modern businesses, enabling seamless communication and data flow between different applications, processes, and departments. Ignoring integration systems can have significant consequences for your business. Here are seven reasons why your business can't afford to ignore integration systems:
### 1. **Enhanced Efficiency:**
Integration systems automate repetitive tasks, reducing manual data entry and minimizing errors. This efficiency boost allows employees to focus on more strategic tasks, ultimately increasing productivity.
### 2. **Improved Data Accuracy:**
By integrating systems, you ensure that data is consistent across all platforms. This accuracy is vital for making informed decisions, enhancing customer service, and maintaining compliance with regulations.
### 3. **Better Customer Experience:**
Integration systems enable a 360-degree view of customer data. This comprehensive understanding of customer interactions and preferences allows businesses to provide personalized services, leading to improved customer satisfaction and loyalty.
### 4. **Streamlined Communication:**
Integration systems facilitate real-time communication between departments, suppliers, and partners. This streamlined communication ensures that everyone has access to the most up-to-date information, promoting collaboration and faster decision-making.
### 5. **Cost Savings:**
Automation and efficiency gains lead to cost savings in the long run. By eliminating manual processes and reducing errors, businesses save time and resources, which can be allocated to more strategic initiatives.
### 6. **Adaptability and Scalability:**
Integration systems are designed to be scalable and adaptable to changing business needs. As your business grows, these systems can easily accommodate new applications and technologies, ensuring that your operations remain efficient and effective.
### 7. **Competitive Advantage:**
In today's fast-paced business environment, staying ahead of the competition is essential. Businesses that embrace integration systems can respond more quickly to market changes, customer demands, and industry trends, giving them a significant competitive advantage.
In conclusion, integration systems are not just a luxury but a necessity for businesses looking to thrive in the digital age. Embracing these systems can lead to improved efficiency, cost savings, better customer experiences, and a strong competitive edge, making them indispensable for any forward-thinking organization.
For more detailed information and a complete reference of the SendInBlue API, you can refer to the official documentation: https://developers.sendinblue.com/reference/email-smtp/
1. Check SendInBlue API, this is payload:
{
"sender": {
"email": "sender@example.com"
},
"to": [
{
"email": "recipient@example.com"
}
],
"subject": "Test email using SendInBlue API",
"htmlContent": "<h1>This is a test email</h1><p>Sent using the SendInBlue API</p>"
}2. Create Object (Table) in AllSync to contain customer email for mapping.3. Configure Integration Flow from AllSync to trigger queue:4. Map Data
Why is it important to enable 2FA?
We highly recommend enabling two-factor authentication (2FA) for security reason:
2FA increases the security of your account. Even if somebody guesses your password, they won’t be able to access your account.
App requirements
Before enabling 2FA for your account on Allsync.io, you need to install authenticator app on your phone. Here are common authenticator apps can be found in your mobile device app store:
Google Authenticator
LastPass Authenticator
Microsoft Authenticator
Authy
How do I enable 2FA?
1. Login to allsync.io, go to My account page
2. Enabling 2FA by click the checkbox 2FA
3. It will popup a screen with a QR code. Follow the steps provided in the screen to complete the setup
4. Open authenticator app, click + add new >> Scan the QR code at step 2
5. Enter the otp shown in authenticator app for step three
6. Test your 2FA setup
After you've set up 2FA, try logging out then logging in from your current device or logging into your account from a different device to make sure everything is working correctly. If you encounter any issues, contact Allsync.io for assistance.
In conclusion, enabling 2FA is a simple and effective way to add an extra layer of security to your Allsync.io account. By following the steps above, you can help protect your personal and sensitive information from unauthorized access.
SAP Business One supports the "Transaction Notification" to capture realtime data once it is successful posted to database.
We can use MS SQL to call AllSync API, this is a trick.
--Enable Ole Automation Procedures in SQL:
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO
Create generate store procedure to call AllSync API
Get AllSync Webhook URL from Integration Flow setting.
SBO_SP_TransactionNotification:
if @object_type=4 --product
begin
declare @json nvarchar(4000)
set @json=( select
ItemCode product_id,
ItemName description
from OITM
where ItemCode=@list_of_cols_val_tab_del
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER
)
exec _allsync_generateQueue @json,'product', @error out, @error_message out
set @error_message=@json
end
create proc [dbo].[_allsync_generateQueue]
@body nvarchar(4000),
@table nvarchar(100),
@error int out,
@error_message nvarchar(200) out
as
declare @serviceUrl nvarchar(500)
set @serviceUrl = 'https://api.allsync.io/QueueIncoming/Hook?tenantID=1&applicationID=SAP&type=product&token=1'
Declare @Object as Int;
Declare @ResponseText as Varchar(8000);
Exec sp_OACreate 'MSXML2.ServerXMLHTTP', @Object OUT;
EXEC sp_OAMethod @Object, 'open', NULL, 'post',@serviceUrl, 'false'
Exec sp_OAMethod @Object, 'setRequestHeader', null, 'Content-Type', 'application/json'
Exec sp_OAMethod @Object, 'send', null, @body
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
Exec sp_OADestroy @Object
if isnull((select value from OPENJSON(@ResponseText) where [key] = 'success'),'')='false'
begin
set @error=-1
set @error_message=isnull((select value from OPENJSON(@ResponseText) where [key] = 'message'),'error from allsync store')
end
select @error, @error_message
Allsync introduces new feature to migrate the configuration from UAT to Live.
It is required to have live tenant id and token, contact support@allsync.io to request for live credentials.
Note: Security User is not included as it may under license control.
Navigate to System > Migration Wizard
Follow the steps to complete the migration:
Enter tenant id and token:
Select application list
Select User Defined Table:
Select Integration Flow:
Select data mapper:
Review and Confirm:
There are different reasons for a failure of a connection, depends on network, internet speed, timeout, 3rd system problem....
So the failure maybe just temporary in short time, if we retry to connect again it may success.
Most of reason of have retry mechanism that 3rd party system can't manage well number of connection from outside, it causes timeout, mainly for in-house or on-premise system. Cloud system manages this situation better.
So AllSync introduce Retry Mechanism to automatic retry sending data to 3rd party systems.
There are 2 new options on application:
- Auto Retry: system will re-process failed queue, but only for the queues created on current date, system won't re-process past failed queue, because it may huge and never success
- Immediate Retry Times: while processing a queue (either it is outgoing queue or incoming queue), if 3rd party system responses FAILED, instead of updating queue status to FAILED and process to next queue, system will re-process and loop x times from configuration, after x times, still failed, then update queue status to FAILED.
Retry Mechanism flow:
AllSync Connectors are running on cloud, however, there are many systems are required Local Network connection, example with SQL database, Oracle Database or SAP Hana Database.. which are not published through internet for allsync connection.
There is an option for user to white list AllSync IPs, so only AllSync can connect, other network will not able to access.
Another option, to deploy the connector on local server, so the integration will connect to local API, local database, and with AllSync and other 3rd party system.
Contact AllSync to request for latest connector installer.
API integration is a crucial aspect of modern software development, allowing different applications to communicate and share data seamlessly. In this comprehensive guide, we will delve into the intricacies of API integration for experts in the field.
What is API Integration?
API, or Application Programming Interface, is a set of rules and protocols that allows one software application to interact with another. API integration involves connecting different systems or applications to enable them to work together effectively.
Why is API Integration Important?
API integration plays a vital role in streamlining processes, improving efficiency, and enhancing user experience. By integrating APIs, developers can leverage the functionality of existing systems and create innovative solutions.
Key Considerations for API Integration
When embarking on API integration projects, experts must consider factors such as security, scalability, performance, and compatibility. It is essential to choose APIs that align with the project requirements and adhere to best practices.
Benefits of API Integration
API integration offers a myriad of benefits, including increased productivity, enhanced functionality, improved data accuracy, and faster time-to-market. By integrating APIs effectively, organizations can gain a competitive edge in the market.
Challenges in API Integration
Despite its benefits, API integration poses challenges such as data security risks, compatibility issues, versioning problems, and complexity in managing multiple APIs. Experts must address these challenges proactively to ensure successful integration.
Best Practices for Successful API Integration
To achieve successful API integration, experts should follow best practices such as thorough planning, documentation, testing, monitoring, and version control. By adhering to these practices, developers can mitigate risks and ensure smooth integration.
Conclusion
In conclusion, API integration is a critical component of modern software development, enabling seamless communication between applications and systems. By understanding the nuances of API integration and following best practices, experts can harness the power of APIs to create innovative solutions and drive business growth.
Are you looking to streamline your business processes and improve efficiency? Look no further than iPaaS, or Integration Platform as a Service. This innovative technology is revolutionizing the way businesses connect their applications, data, and systems. But why should you consider implementing iPaaS for your organization?
Seamless Integration
iPaaS allows for seamless integration between different applications and systems, eliminating the need for manual data entry or complex coding. With iPaaS, you can easily connect your CRM, ERP, and other systems to ensure smooth data flow across your organization.
Increased Efficiency
By automating the integration process, iPaaS helps to increase efficiency and reduce the risk of errors. With real-time data synchronization, you can make informed decisions faster and stay ahead of the competition.
Cost Savings
Implementing iPaaS can lead to significant cost savings for your organization. By reducing the need for custom integration solutions and manual data entry, iPaaS helps to lower operational costs and improve overall ROI.
Scalability
As your business grows, so does the need for scalable integration solutions. iPaaS offers the flexibility to easily scale your integration processes as your business expands, ensuring that you can adapt to changing needs and requirements.
Enhanced Security
Security is a top priority for any organization when it comes to data integration. iPaaS provides built-in security features to protect your data and ensure compliance with industry regulations, giving you peace of mind that your information is safe and secure.
With the numerous benefits that iPaaS offers, it's clear why more and more businesses are turning to this innovative technology to streamline their operations and drive growth. Consider implementing iPaaS for your organization and unlock the power of seamless integration today.