Digital Developer Conference: a FREE half-day online conference focused on AI & Cloud – North America: Nov 2 – India: Nov 9 – Europe: Nov 14 – Asia Nov 23 Register now

Close outline
  • United States
IBM?
  • Site map
IBM?
  • Marketplace

  • Close
    Search
  • Sign in
    • Sign in
    • Register
  • IBM Navigation
IBM Developer Answers
  • Spaces
    • Blockchain
    • IBM Cloud platform
    • Internet of Things
    • Predictive Analytics
    • Watson
    • See all spaces
  • Tags
  • Users
  • Badges
  • FAQ
  • Help
Close

Name

Community

  • Learn
  • Develop
  • Connect

Discover IBM

  • ConnectMarketplace
  • Products
  • Services
  • Industries
  • Careers
  • Partners
  • Support
10.190.13.195

Refine your search by using the following advanced search options.

Criteria Usage
Questions with keyword1 or keyword2 keyword1 keyword2
Questions with a mandatory word, e.g. keyword2 keyword1 +keyword2
Questions excluding a word, e.g. keyword2 keyword1 -keyword2
Questions with keyword(s) and a specific tag keyword1 [tag1]
Questions with keyword(s) and either of two or more specific tags keyword1 [tag1] [tag2]
To search for all posts by a user or all posts with a specific tag, start typing and choose from the suggestion list. Do not use a plus or minus sign with a tag, e.g., +[tag1].
  • Ask a question

Tradeoff analytics 503 Service Unavailable status code when calling show() method from client

310000JV7Y gravatar image
Question by joelriv  (2) | Jun 05, 2015 at 03:08 PM watsontradeoff-analyticsstatus

Hi All,

I have been trying to get the widget to visualize the data from the server by calling the .show() method outlined in the documentation, however, it seems that the call to the API from the client is returning a 503 service not available status code. I am not really sure why or what else to go on, as the documentation really does not offer much information about the TA widget. Here is a snippet of my AJAX call on the client side:

 $(document).ready(function(){
 
     var button = $('.button');
 
     var opts = {
         dilemmaServiceUrl  : 'http://gateway.watsonplatform.net/v1/tradeoff-analytics/api'
     };
 
     var TA = new TradeoffAnalytics(opts, 'widget');
 
 
     button.click(function(){
 
         $.ajax({
             url: '/tradeoff_analytics',
             type: 'POST',
 
             success: function(res){
                 $('#widget').show();
 
 
                 TA.start(function(){
                     console.log('TA service started');
                 });
 
                 TA.show(res);
             },
 
             error: function(status){
                 console.log('There was an error: ' + status);
             }
         });
     });
 });

Any help would be greatly appreciated, thanks.

People who like this

  0
Comment
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster

2 answers

  • Sort: 
27000041J2 gravatar image

Answer by DavidAmid (644) | Jun 06, 2015 at 03:23 PM

Why do you do a POST when the button is clicked? The TA widget is given the input a problem and it (the widget) calls the service for you to render the result.

Comment

People who like this

  0   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
2700056HV0 gravatar image

Answer by 6HV0_David_Boaz (561) | Jun 07, 2015 at 12:22 AM

enter code hereI have few items to add to David Amid's comment. There are 2 ways to use the TA service: Calling the service directly, or using the widget. In the second option, the widget calls the service by it self. You (the consuming application) just need to create the widget with the correct options call start() and then show(data). In your example, it seems that you mixed the two approaches.

  1. If you want to use the ui widget: I assume that url: '/tradeoff_analytics', refers to a local service you use to proxy the TA service. Instead, you should pass this proxy service url to the dilemmaServiceUrl option.

  2. If you call the service directly: a) You are not passing any data (payload) to the service b) The request should contain this header: Content-Type:application/json

Comment

People who like this

  0   Show 1   Share
10 |3000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
2700056HV0 gravatar image 6HV0_David_Boaz (561)   Jun 07, 2015 at 02:24 AM 0
Share

One more comment: start() takes time. the callback function notifies you when the TA instance was started. Only then you can call show(). Hence, I recommend to put the call to show() in the staret callback.

Follow this question

41 people are following this question.

Answers

Answers & comments

Related questions

Would it be possible to include options that are incomplete in Tradeoff Analytics visualization? 2 Answers

Tradeoff Analytics: Why are two options combined under a parent? 1 Answer

Obtain rank values with Tradeoff Analytics 1 Answer

Customization of Tradeoff Analytics Widget version 2 2 Answers

Deploying modified Tradeoff Analytics Node application 1 Answer

  • Contact
  • Privacy
  • IBM Developer Terms of use
  • Accessibility
  • Report Abuse
  • Cookie Preferences

Powered by AnswerHub

Authentication check. Please ignore.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • API Connect
  • Analytic Hybrid Cloud Core
  • Application Performance Management
  • Appsecdev
  • BPM
  • Blockchain
  • Business Transaction Intelligence
  • CAPI
  • CAPI SNAP
  • CICS
  • Cloud Analytics
  • Cloud Automation
  • Cloud Object Storage
  • Cloud marketplace
  • Collaboration
  • Content Services (ECM)
  • Continuous Testing
  • Courses
  • Customer Experience Analytics
  • DB2 LUW
  • Data and AI
  • DataPower
  • Decision Optimization
  • DevOps Build
  • DevOps Services
  • Developers IBM MX
  • Digital Commerce
  • Digital Experience
  • Finance
  • Global Entrepreneur Program
  • Hadoop
  • Hybrid Cloud Core
  • Hyper Protect
  • IBM Cloud platform
  • IBM Design
  • IBM Forms Experience Builder
  • IBM Maximo Developer
  • IBM StoredIQ
  • IBM StoredIQ-Cartridges
  • IIDR
  • ITOA
  • InformationServer
  • Integration Bus
  • Internet of Things
  • Kenexa
  • Linux on Power
  • LinuxONE
  • MDM
  • Mainframe
  • Messaging
  • Node.js
  • ODM
  • Open
  • PartnerWorld Developer Support
  • PowerAI
  • PowerVC
  • Predictive Analytics
  • Product Insights
  • PureData for Analytics
  • Push
  • QRadar App Development
  • Run Book Automation
  • Search Insights
  • Security Core
  • Storage
  • Storage Core
  • Streamsdev
  • Supply Chain Business Network
  • Supply Chain Insights
  • Swift
  • UBX Capture
  • Universal Behavior Exchange
  • UrbanCode
  • WASdev
  • WSRR
  • Watson
  • Watson Campaign Automation
  • Watson Content Hub
  • Watson Marketing Insights
  • dW Answers Help
  • dW Premium
  • developerWorks Sandbox
  • developerWorks Team
  • Watson Health
  • More
  • Tags
  • Questions
  • Users
  • Badges