Welcome to Visual Computer Systems

Business Navigator API

 
 

Seamless Integration to Your Application

 

1- Introduction

RESTFul API to integrate third party solution with Business Navigator Business navigator supports all crud operation using RESTful technology, which enable seamless integration to any third party solutions, Business Navigator Offers API from All the Business activates across the Suit Following is some of the Popular API’s Which is commonly used for third part solution Integrations

API Name API Detail Descriptions Technology
BNSupplierAPI API Supplier master Integration. SupplierNumber, SupplierName, SupplierType, ContactName, PostalCode, Country, City, Phone, Mobile, Email, PaymentTerms, DefaultCurrency RESTful
BNCustomerAPI API Customer master Integration. SupplierNumber, SupplierName, SupplierType, ContactName, PostalCode, Country, City, Phone, Mobile, Email, PaymentTerms, DefaultCurrency RESTful
BNItemMasterAPI ItemCode, ItemDescription, UOM, MajorCategory, MinorCategory, Brand, Part, Weight, Item Type, Service, Serial, BinLocation, Inventory AC, CostofSales AC RESTful
BNSupplierInvoiceAPI InvoiceTypes, SupplierName, LocationName, SupplierInvoiceNo, InvoiceDate, PostingDate DeptCode, SubDoc, ItemQty, UOM, VAT CurrencyRate, RESTful
BNCustomerInvoiceAPI InvoiceTypes, SupplierName, LocationName, SupplierInvoiceNo, SupplierInvoiceDate, PostingDate DeptCode, SubDoc, ItemQty, UOM, VAT CurrencyRate, RESTful
BNCustomerReceiptAPI Collection API, PaymentDate, CustomerNumber, CustomerName, Location, Currency, CashBank PayNumber, ChequeNo. Amount, AmountVariance, Discount RESTful
BNSupplierPaymentAPI PaymentDate, SupplierNumber, SupplierName, Location, CashBank, ChequeNo, AmountPaid, AmountVariance, PartyBankName, Currency RESTful
BNInventoryReceiptAPI ItemCode, Qty, UnitCost, BatchNumber, ExpiryDate, SerialNumber, RESTful
BNCustomerOrderAPI SONumber, SODate, ItemCost, Qty, SellingPrice, Discount, CustomerLocation RESTful
BNSupplierOrderAPI PONumber, PODate, ItemCost, Qty, Selling Price, Discount, CustomerLocation RESTful
BNGRNAPI ItemCode, Qty, PONumber, SerialNumberBatch, TransactionDate, SupplierName, SupplierLocation, RefNumber, Remarks RESTful
BNDeliveryAPI ItemCode, Qty, PONumber, SerialNumberBatch. TransactionDate, CustomerNumber, CustomerLocation, SubDocType, Reference, Remarks RESTful
BNJVAPI AccountID, Debit Amount, CreditAmount, TransactionDate, Remarks RESTful

2- RESTFULL CRUDE OPERATION SAMPLE IN BUSINESS NAVIGATOR

 

Read / Retrieve

Business Navigator ERP API allows reading or retrieving the data with the help of following step.
This is how the page is rendered when a user opens Product Catalog Manager in a web browser. Only the search controls are visible. The panel with product properties is hidden.
If a user enters search criteria and clicks Find button then the matched products are displayed in the list box.
This is the implementation of the JavaScript method invoked when Find button is clicked and the compatible products are listed down.

Sample Code for Reading Web Service

showSupplierList: function () {
                var query = '?_sortExpression=Vendor_Name&_q=' + encodeURIComponent($('#QuickFind').val());
                $.ajax({
                        url: this.basePath() +'/BNSupplierAPI' + query,
                        cache: false,
                        dataType: 'jsonp',
                        success: function (data) {
                                var selectedValue = $('#SupplierList').val();
                                $.each(data.BNSupplierAPI, function (index, supplier) {
                                        $('<option>')
                                        .text(supplier.Sys_Number + ' / ' +
                                        supplier.Vendor_Name + ' / ' +
                                        supplier.DefaultCurrency + ' / ' +
                                        supplier.RecordType)
                                        .attr('value', supplier.Sys_Number)
                                        .appendTo($('#SupplierList'));
                                        });
                                $('#SupplierList').val(selectedValue);
                                $('#SupplierListPanel').show();
                            }
               });
}

 

Create / Write

Business Navigator ERP API allows writing the data with the help of following step.
If a product does not exist in the database than a user can click on New Product button to create a product.
A panel with blank product properties will be displayed. The value of the hidden field ProductID is set to a null value.

Sample Code for Create/Write Web Service

newSupplier: function () {
                        $('#SupplierSearchPanel').hide();
                        $('#DeleteButton').hide();
                        $('#SupplierDetailsPanel').show();
                        $('#Sys_Number').attr('value', null);
                        $('#Vendor_Name').attr('value', 'New Supplier').focus().select();
                        $('#DefaultCurrency').attr('value', null);
                        $('#RecordType').attr('value', null);
                },

If a user enters values and presses Save then an AJAX request will be sent to the web app with a URI configured to save a product.
The user will see a confirmation box displaying a new product ID if the operation was successful.
The code behind the Save button is presented next.

saveSupplier: function () {
                                if (!confirm('Save?')) return
                                var requestType = $('#Sys_Number').val() != '' ? 'PUT' : 'POST';
                                $.ajax({
                                        url: this.createSupplierUrl(requestType),
                                        dataType: 'jsonp',
                                        type: requestType,
                                        data: SupplierManager.collectFieldValues(),

                                        success: function (result) {

                                                if (result.errors)
                                                        alert(result.errors[0].message);
                                                else {
                                                        if (this.url.match('_type=POST'))
                                                            alert('New supplier Created');
                                                        SupplierManager.refreshSearch();
                                                    }
                                                }
                                        });
                                },

                        };

If the product ID is blank then the parameter “_typeâ€‌ is equal to POST, which instructs the application server to create a new product.

Sample Code for Reading Web Service

showSupplierList: function () {
                var query = '?_sortExpression=Vendor_Name&_q=' + encodeURIComponent($('#QuickFind').val());
                $.ajax({
                        url: this.basePath() +'/BNSupplierAPI' + query,
                        cache: false,
                        dataType: 'jsonp',
                        success: function (data) {
                                var selectedValue = $('#SupplierList').val();
                                $.each(data.BNSupplierAPI, function (index, supplier) {
                                        $('<option>')
                                        .text(supplier.Sys_Number + ' / ' +
                                        supplier.Vendor_Name + ' / ' +
                                        supplier.DefaultCurrency + ' / ' +
                                        supplier.RecordType)
                                        .attr('value', supplier.Sys_Number)
                                        .appendTo($('#SupplierList'));
                                        });
                                $('#SupplierList').val(selectedValue);
                                $('#SupplierListPanel').show();
                            }
                      });
                },

 

Update

Business Navigator ERP API allows update the data with the help of following step.
If a user selects a product in the list and clicks Show Details button then the product details are displayed.
The button will initiate a web request to obtain product information.

Sample Code for Update Web Service

showSupplierDetails: function (Sys_Number) {
                        if (Sys_Number == null) return;
                        $('#SupplierSearchPanel').hide();
                        $('#DeleteButton').show();
                        $.ajax({
                                url: this.basePath() + '/BNSupplierAPI/editForm1/' + Sys_Number,
                                cache: false,
                                dataType: 'jsonp',
                                success: function (supplier) {

                                        $('#SupplierDetailsPanel').show();
                                        $('#Sys_Number').attr('value', supplier.Sys_Number);
                                        $('#Vendor_Name').attr('value', supplier.Vendor_Name).focus();
                                        $('#DefaultCurrency').attr('value', supplier.DefaultCurrency);
                                        $('#RecordType').attr('value', supplier.RecordType);
                                    }
                  });
}

 

Delete

Business Navigator ERP API allows delete the data with the help of following step.
The “Deleteâ€‌ button is rendered next to “Saveâ€‌ on the product details panel. User has to click Find and select a product to activate the panel.
If the product deletion is confirmed then an AJAX request will be executed.
Product Catalog Manager will delete the selected product with the following code.

Sample Code for Delete Web Service

deleteSupplier: function () {
                        if (!confirm('Delete?')) return;
                        $.ajax({
                        url: this.createSupplierUrl('DELETE'),
                        dataType: 'jsonp',
                        type: 'DELETE',
                        data: SupplierManager.collectFieldValues(),
                        success: function (result) {
                                if (result.errors)
                                        alert(result.errors[0].message);
                                else
                                        SupplierManager.refreshSearch();
                        }
             });
}

The code will execute a JSONP request with DELETE specified in the product URI as a value of parameter “_typeâ€‌.

 

Source Code

The complete source code of Product Catalog Manager is presented next.

Sample Source Code for Web Service

<!DOCTYPE html>
<html>
<head>
<title>Supplier API</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript" src="http://192.168.0.102/API/appservices/BNSupplierAPI?_instance=SupplierData">
        </script>
        <script type="text/javascript">
                var SupplierManager = {
                // Returns the url of the application server of a demo web app.
                basePath: function () { return 'http://192.168.0.102/API/appservices'; },
                showSupplierList: function () {
                var query = '?_sortExpression=Vendor_Name&_q=' + encodeURIComponent($('#QuickFind').val());
                $.ajax({
                        url: this.basePath() +'/BNSupplierAPI' + query,
                        cache: false,
                        dataType: 'jsonp',
                        success: function (data) {
                                var selectedValue = $('#SupplierList').val();
                                $.each(data.BNSupplierAPI, function (index, supplier) {
                                        $('<option>')
                                        .text(supplier.Sys_Number + ' / ' +
                                        supplier.Vendor_Name + ' / ' +
                                        supplier.DefaultCurrency + ' / ' +
                                        supplier.RecordType)
                                        .attr('value', supplier.Sys_Number)
                                        .appendTo($('#SupplierList'));
                                        });
                                $('#SupplierList').val(selectedValue);
                                $('#SupplierListPanel').show();
                            }
                      });
                },
                showSupplierDetails: function (Sys_Number) {
                        if (Sys_Number == null) return;
                        $('#SupplierSearchPanel').hide();
                        $('#DeleteButton').show();
                        $.ajax({
                                url: this.basePath() + '/BNSupplierAPI/editForm1/' + Sys_Number,
                                cache: false,
                                dataType: 'jsonp',
                                success: function (supplier) {

                                        $('#SupplierDetailsPanel').show();
                                        $('#Sys_Number').attr('value', supplier.Sys_Number);
                                        $('#Vendor_Name').attr('value', supplier.Vendor_Name).focus();
                                        $('#DefaultCurrency').attr('value', supplier.DefaultCurrency);
                                        $('#RecordType').attr('value', supplier.RecordType);
                                    }
                            });
                        },
                        backToSearch: function () {
                                $('#SupplierDetailsPanel').hide();
                                $('#SupplierSearchPanel').show();
                                $('#SupplierList').focus();
                        },
                        // Refreshes the search result.
                        refreshSearch: function () {
                        this.backToSearch();
                        this.showSupplierList();
                        },
                        createSupplierUrl: function (requestType) {
                                if (requestType == 'POST')
                                        return this.basePath() + '/BNSupplierAPI/createForm1?_type=' + requestType;
                                return this.basePath() + '/BNSupplierAPI/editForm1/' + encodeURIComponent($('#Sys_Number').val()) +
                                '?_type=' + requestType;
                        },
                        collectFieldValues: function () {
                                return {
                                        Sys_Number: $('#Sys_Number').val(),
                                        Vendor_Name: $('#Vendor_Name').val(),
                                        DefaultCurrency: $('#DefaultCurrency').val(),
                                        RecordType: $('#RecordType').val()
                                };
                            },
                // Deletes a Suppliers.
                deleteSupplier: function () {
                        if (!confirm('Delete?')) return;
                        $.ajax({
                        url: this.createSupplierUrl('DELETE'),
                        dataType: 'jsonp',
                        type: 'DELETE',
                        data: SupplierManager.collectFieldValues(),
                        success: function (result) {
                                if (result.errors)
                                        alert(result.errors[0].message);
                                else
                                        SupplierManager.refreshSearch();
                        }
                    });
                },
                newSupplier: function () {
                        $('#SupplierSearchPanel').hide();
                        $('#DeleteButton').hide();
                        $('#SupplierDetailsPanel').show();
                        $('#Sys_Number').attr('value', null);
                        $('#Vendor_Name').attr('value', 'New Supplier').focus().select();
                        $('#DefaultCurrency').attr('value', null);
                        $('#RecordType').attr('value', null);
                },
                        saveSupplier: function () {
                                if (!confirm('Save?')) return
                                var requestType = $('#Sys_Number').val() != '' ? 'PUT' : 'POST';
                                $.ajax({
                                        url: this.createSupplierUrl(requestType),
                                        dataType: 'jsonp',
                                        type: requestType,
                                        data: SupplierManager.collectFieldValues(),

                                        success: function (result) {

                                                if (result.errors)
                                                        alert(result.errors[0].message);
                                                else {
                                                        if (this.url.match('_type=POST'))
                                                            alert('New supplier Created');
                                                        SupplierManager.refreshSearch();
                                                    }
                                                }
                                        });
                                },

                        };
                        $(document).ready(function () {
                                $('#SupplierListPanel,#SupplierDetailsPanel').hide();
                                $('#FindButton').click(function (e) {
                                        e.preventDefault();
                                        SupplierManager.showSupplierList();
                                });
                                $('#ShowDetailsButton').click(function (e) {
                                        e.preventDefault();
                                        SupplierManager.showSupplierDetails($('#SupplierList').val());
                                });
                                $('#BackToSearchButton').click(function (e) {
                                        e.preventDefault();
                                        SupplierManager.backToSearch();
                                });
                                $('#NewButton').click(function (e) {
                                        e.preventDefault();
                                        SupplierManager.newSupplier();
                                });
                                $('#SaveButton').click(function (e) {
                                        e.preventDefault();
                                        SupplierManager.saveSupplier();
                                });
                                $('#DeleteButton').click(function (e) {
                                        e.preventDefault();
                                        SupplierManager.deleteSupplier();
                                });
                        });
                </script>
                <style type="text/css">
                        body, button, input, select {
                                font-family: Tahoma;
                                font-size: 8.5pt;
                        }

                        #QuickFind {
                                width: 280px;
                        }

                        #SupplierList {
                                width: 350px;
                                height: 208px;
                                margin-bottom: 4px;
                        }

                        #FindButton {
                                width: 60px;
                        }

                        #SupplierListPanel {
                                margin-top: 4px;
                        }

                        .Field {
                                padding-bottom: 4px;
                        }

                        #SupplierDetailsPanel {
                                margin-top: 4px;
                                padding: 8px;
                                border: solid 1px silver;
                                display: inline-block;
                        }

                        .Field label {
                                display: block;
                                color: green;
                        }

                        .Field input {
                                width: 300px;
                        }
                </style>
            </head>
        </head>
    <body>
            <div>
                <div id="SupplierSearchPanel">
                        <input id="QuickFind" type="text" />
                        <button id="FindButton">Find</button>
                        <div id="SupplierListPanel">
                                <select id="SupplierList" size="5"></select>
                        <div>
                        <button id="ShowDetailsButton">Show Details</button>
                        <button id="NewButton">New Supplier</button>
                        </div>

                        </div>
                </div>
                <div id="SupplierDetailsPanel">
                        <input id="Sys_Number" type="hidden"/>
                        <div class="Field">
                        <label for="Vendor_Name">Vendor_Name:</label>
                        <input id="Vendor_Name" />
                </div>
                <div class="Field">
                        <label for="DefaultCurrency">Default Currency:</label>
                        <input id="DefaultCurrency" />
                </div>
                <div class="Field">
                        <label for="RecordType">Record Type:</label>
                        <input id="RecordType" />
                </div>
                <div>
                        <button id="BackToSearchButton">Back To Search</button>
                        <button id="SaveButton">Save</button>
                        <button id="DeleteButton">Delete</button>
                </div>
            </div>
       </div>
    </body>
</html>