1 Reply Latest reply on Jun 10, 2016 9:05 AM by msa s

    Error:URL points to a website, not a web data connector

    Rajeshwari Guddeti

      Hello,

       

      I'm getting "error : URL points to a website, not a web data connector" even after following the same steps that has been given in web data connector tutorial steps. I'm able to get the result on localhost that i have created but not able to get the same in Tableau

       

      <html>

      <meta http-equiv="Cache-Control" content="no-store" />

      <head>

        <title>Stock Quote Connector-Tutorial</title>

        <script src="https://connectors.tableau.com/libs/tableauwdc-1.1.1.js" type="text/javascript"></script>

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>

       

       

        <script type="text/javascript">

        (function() {

            function buildUri(tickerSymbol, startDate, endDate) {

            var startDateStr = getFormattedDate(startDate);

            var endDateStr   = getFormattedDate(endDate);

            var queryStatement = 'select * from yahoo.finance.historicaldata where symbol = "' +

                                  tickerSymbol +

                                 '" and startDate = "' + startDateStr +

                                 '" and endDate = "' + endDateStr + '"';

             var uri = 'http://query.yahooapis.com/v1/public/yql?q=' +

                      encodeURIComponent(queryStatement) +

                      "&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json";

            return uri;

          }

       

       

          function getFormattedDate(date) {

              // Returns a date in the format YYYY-MM-DD

              return date.getUTCFullYear()  +

                     '-' +

                     makeTwoDigits(date.getUTCMonth() + 1) +

                     '-'

                     + makeTwoDigits(date.getUTCDate());

          }

       

       

          function makeTwoDigits(num) {

             // Pads a digit to be two digits with leading zero

             return num <= 9 ? "0" + num.toString() : num.toString();

          }     

       

       

            var myConnector = tableau.makeConnector();

       

       

            myConnector.getColumnHeaders = function() {

                var fieldNames = ['Ticker', 'Day', 'Close'];

           var fieldTypes = ['string', 'date', 'float'];

                tableau.headersCallback(fieldNames, fieldTypes);

            }

       

       

            myConnector.getTableData = function(lastRecordToken) {

          var dataToReturn = [];

          var hasMoreData = false;

       

       

          // Get parameter values and build YQL query

          var ticker = tableau.connectionData;

          var endDate = new Date();

          var startDate = new Date();

          startDate.setYear(endDate.getFullYear() - 1);

          var connectionUri = buildUri(ticker, startDate, endDate);

       

       

          var xhr = $.ajax({

            url: connectionUri,

            dataType: 'json',

            success: function (data) {

                if (data.query.results) {

                    var quotes = data.query.results.quote;

                    var ii;

                    for (ii = 0; ii < quotes.length; ++ii) {

                        var entry = {'Ticker': quotes[ii].Symbol,

                                     'Day': quotes[ii].Date,

                                     'Close': quotes[ii].Close};

                        dataToReturn.push(entry);

                    }

                    tableau.dataCallback(dataToReturn, lastRecordToken, false);

                  }

                  else {

                    tableau.abortWithError("No results found for ticker symbol: " + ticker);

                  }

            },

            error: function (xhr, ajaxOptions, thrownError) {

                // If the connection fails, log the error and return an empty set.

                tableau.log("Connection error: " + xhr.responseText + "\n" + thrownError);

                tableau.abortWithError("Error while trying to connecto to the Yahoo stock data source.");

            }

          });

      }

            tableau.registerConnector(myConnector);

        })();

       

        $(document).ready(function() {

          $("#submitButton").click(function() {

            var tickerSymbol = $('#ticker').val().trim();

            if (tickerSymbol) {

              tableau.connectionName = "Stock Data for " + tickerSymbol;

              tableau.connectionData = tickerSymbol;

              tableau.submit();

            }

          });

        });

      </script>

      </head>

      <body>

        <p>Enter a stock ticker symbol: <input type="text" id="ticker" /></p>

        <p><button type="button" id="submitButton">Get the Data</button></p>

      </body>

      </html>

       

      Below is the screenshot of error :