Instant Inventory - Custom Integration


How to implement custom integration of RapNet Instant Inventory

Before you start

First you have to set up your feed for Instant Inventory. You choose your suppliers, which diamonds you want to resell and what markup you want to use. After the setup it can take several hours before your feed is fully ready. The setup screen can be found here (requires a subscription to RapNet with Instant Inventory).

API's authenticate

For authenticate you can use your user name and password, or create a separate set of credentials for programmatic access for more details.

How it works

The inventory database is maintained by RapNet and changes are updated about every 4 hours automatically. Instead of using your own database, you will use our web services to query diamond listings.

Download Format Technology/Communication Code Samples
XML/Dataset (.NET) SOAP XML Web Service
More information can be found here
JSON HTTP Post

Certificate Images and Scans:


Certificate images and certificate scans are not passed via web services. Rather, the correct way to see the image (no need to download) is to use the URL , Replace XXX with the lot number in order for it to work. http://www.diamondselections.com/GetCertificate.aspx?diamondid=XXX

To get the Certificate Image and Scans Path:


Use the following link: http://www.diamondselections.com/GetCertificatePath.aspx?diamondid=XXX

Note: We may not have an uploaded image for every diamond. Programmers must take this into account. When the programmer uses the “GetDiamond” or “GetSingleDiamonds” webservice, part of the results that are returned will include (besides all the diamond details) is a field called “HasCertFile”. If this is true (ie Yes), then we have a cert image on file and they can view it using the above URL.


AngularJS widget - Integrate into my ecommerce

By setting up an observer in javascript you will be able to POST the diamond information to an API on your end. The API on your side must do two things in this order:
First - you must create the product in your inventory.
Second - you have to add the product to the users cart.
Finally you may return a success or an error message to the javascript application.

Example Below. Note - JS should be placed after the diamond search is loaded and included in script tags

                            
							
(function(d, w) {
    function observeAddToCart() {
        jQuery(w).on('ds.addtocart', function(event, data) {
            jQuery.ajax({
                //This is the API to where to POST the data to.
                url: '/api/add_to_inventory_and_add_to_cart',
                type: 'POST',
                data: data
            }).done(function(res) {
                //On success of the API call
                w.location = '/success';
            }).fail(function(res) {
                //On fail of the API call
                alert(res.message);
            });
        });
    }
    if (d.addEventListener) {
        d.addEventListener('ds.ready', function() {
            observeAddToCart();
        }, false);
    } else if (d.attachEvent) {
        d.documentElement.attachEvent('onpropertychange', function(event) {
            if (event.propertyName === 'ds.ready')
                observeAddToCart();
        });
    }
}(document, window));