Browse DevX
Sign up for e-mail newsletters from DevX


Create a Modern Extension to Your Online Business with a Public API

More and more online retailers and other technology companies are finding ways to market and extend their businesses using Web services. Don't let the boat pass you by. Learn how to create a simple API to launch your own affiliate network.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

or several years now, the use of affiliate networks in e-commerce has grown tremendously. Amazon, the vanguard of this technique, and many companies like it allow anyone who can consume a Web service to become an affiliate. Being an affiliate means you sell goods on their behalf—for a cut of the profit.

From a technological point of view, it's a bold leap for these retailers—effectively opening up their data centers and their business processes to outsiders. But with a bold leap comes the potential of a rich reward, and it is this reward—an enormous extension of their market reach, with the bulk of the work done by others—that justifies any risk.

The technology that enables this extra reach is the technology of Web services, which is based on these pillars:

  • Extensible Markup Language (XML)—A text-based format that allows data to be richly attributed and tagged. Most importantly, it is machine-readable and parseable.
  • Simple Object Access Protocol (SOAP)—An XML variant that may be used to describe how you call functionality on a Web service and the data that is returned from it.
  • Web Services Definition Language (WSDL)—An XML variant that describes a Web service and how you can talk to it. Again this is machine readable, so you can use this to automatically generate code that can talk to Web services and understand their responses using SOAP.
  • Universal Description, Discovery and Integration (UDDI)—A directory standard where you can publish your Web service WSDL for others to find and consume.
When using these technologies, the process of opening up your business processes to the public in a secure manner becomes relatively easy. With a bit of thought, most online companies can begin to publish their content, their products, or their services publicly through an API, so that an affiliate network can grow and sell those products or services.

What you'll learn in this article will turn the affiliate relationship on its head—putting your business in the driver's seat and using Web services to create an affiliate or similar program that can grow your business. In other words, if you already have a viable business, and you want to do the same thing as the Amazons and PayPals of the world, you can create your own API that allows affiliates to use your business resources. In this article, you'll build a simple commercial Web site using C# and Web services, and see how these can be exposed to your clients so that they can become affiliates that sell your goods on your behalf and get a percentage that you determine.

Architecture of a Simple Store
The code available in the download (get it here or from the link in the left-hand column) contains the implementation and database setup scripts of a very simple online store that provides affiliation. The database has a number of tables:

  • Products: Details of the products that you sell.
  • Affiliates: Details of the affiliates that you have signed up.
  • Sales: Details of a sales transaction including the affiliate that made the sale.
In addition to this there are a number of Web services that use this data. These Web services are the core of the API that you will offer to your affiliates.
  • Affiliate Sign Up: Handles the signing up of affiliates, adding them to the database, and assigning them an identifier.
  • Affiliate Sale: Handles a sale made by an affiliate. The affiliate will pass the customer information to your site, which will then process the transaction, generating a transaction reference number that is returned to the affiliate to return to their client—the one who is purchasing the goods.
  • Catalog Query: Used by an affiliate to query current inventory so they can offer those products to their customers in real time.
  • Check Specific Item is in Stock: The Catalog Query tells the affiliate whatyou have in stock. However, in the time lag between this query being run and a specific customer transaction, stock levels may change. This API call lets the affiliate check inventory again before finalizing the transaction with its customer.

These Web services have no user interface. You can create whatever front end you like to access them, as can your affiliates, allowing custom branding to be built. Some samples of Web forms that could be used by either you or your affiliates are available in the download.

Thanks for your registration, follow us on our social networks to keep up-to-date