WU for dummies

  • 1
  • Question
  • Updated 2 years ago
I want to place a small forecast with icons on my web page.  I have an API key, but isn't there a basic how-to link that helps newbies to accomplish this? 

It does seem that on the github page there's an enormous amount of detail for techies that is far beyond the expertise of many.  I can't imagine that all users on this forum have gone through a compiling procedure as suggested there.  I must be missing something, namely simple instructions that help users to set up HTML that will call the WU report — with a few of those lovely icons.  I really appreciate any help!
Photo of gussy

gussy

  • 3 Posts
  • 0 Reply Likes

Posted 2 years ago

  • 1
Photo of James Anding

James Anding

  • 64 Posts
  • 49 Reply Likes
I don't think this is the right place for you to do that. There are much simpler places on the internet to get forecast icons for a simple web site. If you don't know anything about HTML, java code or programming in general you will have a very tough time with the API's here. They are great, but not for someone who isn't experienced in those things. I don't think there is enough room here to write something like you want. Good luck in your adventures. Try looking at this location. https://www.theweather.com/widget/ 
Photo of gussy

gussy

  • 3 Posts
  • 0 Reply Likes
Thanks, James.  Well, actually I do know quite a bit about HTML.  I'm just not good at scripting and took for granted that WU would have some pre-built methods for those of us who want a less troublesome way of getting on board.  I did, however, check out your link, but as you must know, the options aren't as good as those offered by the wunderground API -- including reporting on our specific location.

I'm still anxious to proceed with WU, but I'm hoping that someone here might have posted some clearer, step-by-step routine, or even offer their expertise for compensation.
Photo of James Anding

James Anding

  • 64 Posts
  • 49 Reply Likes

I can give you this info.  I have used many API's from WU and have never used anything from the Github. Practically anything you want to do is listed on the API page with some coding examples.  The problem comes from experience using java scripts and understanding how to parse the Json returns from jQuery routines inside your HTML page.  This takes some experimenting and patience.  The examples are directed toward programmers mainly. I am a C++ engineer and I struggled understanding how to use them because my java script and using json was limited.  If no one gives you a good answer how to proceed and you still want to peruse this adventure, you can send me your email address and I can send you some code snips with screen shots to help you get started. My time is somewhat limited but I enjoy a challenge. Good luck. 

Photo of gussy

gussy

  • 3 Posts
  • 0 Reply Likes
Very good of you.  I'll roll up my sleeves.

I don't see a personal messaging feature here, but I'll get you my email address somehow soon.
Photo of James Anding

James Anding

  • 64 Posts
  • 49 Reply Likes
I sent you some test code today.
If you haven't received it let me know.
Photo of Jerry Ferris

Jerry Ferris

  • 1 Post
  • 1 Reply Like
Hi Gussy, James, I believe Gussy does bring up a very valid point on this as there are MANY HTML developers that are NOT that great with more advanced java routines and scripting and do rely on examples/direction to get things like this on web pages. James, would you be interested in sharing any of your basic code you have made work with more of us? All I am after at this time is a clean, basic way I can get forecast data to parse to a webpage, that's it. Most of the time if I see how the actual coding was done I can go from there and hopefully get more things accomplished and use the API more. I understand your time is valuable and I'm not looking for a "feebie" here, just have spent a LOT of time looking for a way to do this with the WU API and so far, nothing. The outside widgets and other options as Gussy said are available, yes, but they are what they are, no way to modify much with them. - I too would really appreciate some good, starting working examples to use as I am sure a LOT of us would. My email is jerry@fpweathercom if that works. If you prefer not to share I can understand, your time and expertise is worth something I completly agree and if I can offer anything to get some examples, please let me know what it may be. - THANKS- Jerry
Photo of Brian Minor

Brian Minor

  • 4 Posts
  • 0 Reply Likes
Hi all, I just recently started coding within this past month have been running into the same issues.  I did happen to find my own solution, though, so I thought I'd share.  This is one of the sample codes provided by WU.  The format's going to be a mess, so here's the link.  It's the bottom example.  Make sure to swap your own API key for the asterisks.

https://www.wunderground.com/weather/api/d/docs?d=resources/code-samples

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>; <script> jQuery(document).ready(function($) { $.ajax({ url : "http://api.wunderground.com/api/********/geolookup/conditions/q/IA/Cedar_Rapids.json";, dataType : "jsonp", success : function(parsed_json) { var location = parsed_json['location']['city']; var temp_f = parsed_json['current_observation']['temp_f']; alert("Current temperature in " + location + " is: " + temp_f); } }); }); </script>

For my needs I changed this around to:

function getTemp($) {
$.ajax({  url : "http://api.wunderground.com/api/8330df092372797a/geolookup/conditions/q/WI/Madison.json",
  dataType : "jsonp",
  success : function(parsed_json) {
  var location = parsed_json['location']['city'];
  var temp_f = parsed_json['current_observation']['temp_f'];
  document.getElementById("currentTemp").innerHTML = temp_f;
  }
  });
}

Here's the part of the code that was parsing the current conditions.

var temp_f = parsed_json['current_observation']['temp_f'];

Forecasting is a bit different.  Here's the example URL they provide.

http://api.wunderground.com/api/**********/forecast/q/CA/San_Francisco.json

Here's how to parse the forecast info.

var fore_high = parsed_json['forecast']['simpleforecast']['forecastday'][0]['high']['fahrenheit'];

If you use this info, along with looking up the sample URL's to see what info is included in the "response".  You should be all set.  If you're trying to get this info on a watch face I may be able to help there too.
(Edited)
Photo of Adel Ibrahim

Adel Ibrahim

  • 1 Post
  • 0 Reply Likes
منتديات

I'm sorry, I can't help you.