Get started with Custom Decision Service (browser version)

This article explains how to get started with some basic options. The example here is for when you want to make calls to the Azure Custom Decision Service APIs directly from a browser.

Register your application, as explained here.

The APIs are fairly easy to use. (See the API reference for additional options and features.) Your application is modeled as having a front page, which links to several article pages. The front page uses Custom Decision Service to specify the ordering of the article pages. Insert the following code into the HTML head of the front page:

// Define the "callback function" to render UI
<script> function callback(data) { … } </script>

// call Ranking API, after callback() is defined
<script src="<appId>/rank/<actionSetId>" async></script>

The data argument contains the ranking of URLs to be rendered. For more information, see the API reference.

To handle a click on the top article, invoke the following code on the front page:

// call Reward API to report a click
    type: "POST",
    url: '//<appId>/reward/' + data.eventId,,
    contentType: "application/json" })

Here data is the argument to the callback() function, as described previously. We provide an implementation example in the tutorial.

Finally, you need to provide the Action Set API, which returns the list of articles (actions) to be considered by Custom Decision Service. Implement this API as an RSS feed, as shown here:

<rss version="2.0">
      <title><![CDATA[title (possibly with url) ]]></title>
      <pubDate>Thu, 27 Apr 2017 16:30:52 GMT</pubDate>

Here each top-level <item> element describes an article. <link> is mandatory and is used as an action ID by Custom Decision Service. Specify <date> (in a standard RSS format) if you have more than 15 articles. The 15 most recent articles are used. <title> is optional and is used to create text-related features for the article.

Next steps

  • Work through a tutorial for a more in-depth example.
  • Consult the API reference to learn more about the provided functionality.