Author Topic: Newbie question - sorry  (Read 618 times)

cbristow

  • Newbie
  • *
  • Posts: 3
Newbie question - sorry
« on: August 06, 2010, 10:18:08 PM »
Just getting started with the whole IObridge thing here, so please excuse the newbie question.

I am a software AND  IObridge newbie.  I am trying to get a simple webpage running to fetch data from my iobridge, so I copied the example  from

http://www.iobridge.net/wiki/api/data-feed-api

My thought was that I could copy the code for the temp meter source code example, and replace the API key in the source code with my own, and then move on from there,

here is the original line...

 
function checkTemp() {
   $.getJSON("http://www.iobridge.com/api/feed/key=0BosKdymNbB3LyiFYUVI&callback=?",
   function (data) {
         updateGraph(data.module.channels[0].AnalogInput);
   });
the example works fine as one would expect.
here is the line I modified....
function checkTemp() {
   $.getJSON("http://www.iobridge.com/api/feed/key=serF8rpNLcxZ0CZv6e&callback=?",
   function (data) {
         updateGraph(data.module.channels[0].AnalogInput);
   });

But it produces a blank screen.
The temperature chart example behaves the same way, with the text for the page being displayed, but no data fetched from the module.  WHat am I missing?


Any help appreciated.

nick

  • Full Member
  • ***
  • Posts: 174
Re: Newbie question - sorry
« Reply #1 on: August 07, 2010, 10:31:33 PM »
Divide and conquer.  Break the problem into smaller pieces.

Verify that the only change you made between the successful and the unsuccessful was changing the key.

You can retrieve the data directly by taking everything in quotes in your getJSON call and putting it into your browser's address bar. Save what comes back as a text file and open it in a word processor. Verify that your browser is capable of retrieving the info, and compare the data.

Comment out the call to updateGraph() and see if the page runs. Try just displaying
data.module.channels[0].AnalogInput rather than calling updateGraph().

cbristow

  • Newbie
  • *
  • Posts: 3
Re: Newbie question - sorry
« Reply #2 on: August 08, 2010, 07:59:32 PM »
Nick,

Thanks for the help.... it got me going in the right direction.  Using the JSON call in my browser did the trick, now I'm seeing the data I want, and can manipulate it.  Thanks again.

Chuck