Hi everyone... I am very frustrated trying to get an API call to Open Weather Maps to return usable data. I am new at programming with Arduino and am struggling here. I have managed to get the code to return something but not what I would expect.
Here is an example of one of my attempts at constructing an API call:
cmd = "GET http://api.openweathermap.org/data/2.5/forecast/city?id=6159905&APPID=xxxxxxxxxxxxxxxxxxxxx\r\n\r\n\r\n";
The city ID is for Surrey, BC and the API number is mine but here I have replaced it with 'x's for security reasons.
I have tried many different ways of constructing the code and have read the examples on the Open Weather web site but to no avail...
I am using a Arduino Mega 2560 with a ESP8266 connected to Serial1 and when it runs I get it to connect with my WiFi and it gives the correct 'OK' responses to each step of the setup but when it gets to sending the API call it seems to return a text version of the raw Open Weather web page and lots and lots of it. (Example of some of this text follows:
responseString =
<div class=small-2 columns hide-for-small-only climate>
<h6>Mobile Apps</h6>
<ul class=no-bullet>
<li><a href=/download/index.asp#ios>Apple iOS</a></li>
<li><a href=/download/index.asp#android>Google Android</a></li>
<li><a href=/download/index.asp#roku>Roku</a></li>
</ul>
</div>
<div class=small-2 columns hide-for-small-only activities>
<h6>Activities & Travel</h6>
<ul class=no-bullet>
<li><a href=/ski/>Ski & Snow Reports</a></li>
<li><a href=/MAR/>Marine Weather</a></li>
<li><a href=/roadtrip/>Road Trip Planner</a></li>
</ul>
</div>
</div>
</nav>
<div class=company>
<div class=row collapse>
<div class=small-12 medium-1 large-2 columns>
<ul class=no-bullet
+IPD,
Checking Data...
responseString =
>
<li><a href=https://www.facebook.com/wunderg
+IPD,
Checking Data...
responseString =
/stickers/ title=Weather Widgets>collapse>
<div class=small-12 medium-8 medium-push-4 large-8 columns>
<ul class=inline-list>
<li><a href=/about/contact.asp>Contact</a></li>
<li><a href=http://help.wunderground.com/>Support & Feedback</a></li>
<li><a href=/members/tos.asp#terms>Terms of Use</a></li>
<li><a href=/members/tos.asp#privacy>Privacy Statement</a></li>
<li><a href=/adchoices.asp class=ad-choices>AdChoices</a></li>
</ul>
</div>
<div class=small-12 medium-4 medium-pull-8 large-4 columns>
<p>Copyright © 2016 The Weather Channel,
Can anyone help set me straight or give me some clues?
(I would have submitted the whole code but there seems to be a limit of 9000 characters)
Thanks
Sam