Connect the API with IP instead of the subdomain api.wunderground.com

  • 1
  • Question
  • Updated 6 years ago
Hallo,

iam trying to connect to the api with an Basicprogrammed Microcontroller. My Problem is that i can only connect with IPadresses instead of a domain/subdomain names.

I send this (raw tcpip) to the server:

Tcpwrite(i , "GET /api/my_valid_api_key/astronomy/q/DL/Freiburg.json HTTP/1.1{013}{010}" ) ' send get
Tcpwrite(i , "Host: api.wunderground.com{013}{010}" ) ' give the Hostname

Here the Response:

S:0 HTTP/1.1 200 OK
S:0 Date: Wed, 05 Dec 2012 18:20:50 GMT
S:0 Server: Apache/1.3.42 (Unix) PHP/5.3.2
S:0 Cache-control: no-cache, must-revalidate, no-cache="Set-Cookie", private
S:0 Expires: Fri, 01 Jan 1990 00:00:00 GMT
S:0 Pragma: no-cache
S:0 X-CreationTime: 0.018
S:0 Set-Cookie: DT=1354731650:7795:365-q3; path=/; expires=Fri, 01-Jan-2020 00:00:00 GMT; domain=.wunderground.com
S:0 Connection: close
S:0 Transfer-Encoding: chunked
S:0 Content-Type: text/plain
S:0
S:0 109
S:0
S:0
S:0 {
S:0 "response": {
S:0 "version": "0.1"
S:0 ,"termsofService": "http://www.wunderground.com/weather/a..."
S:0 ,"features": {
S:0
S:0 }
S:0
S:0 ,
S:0 "error": {
S:0 "type": "missingkey"
S:0
S:0 ,"description": "you must supply a key"
S:0
S:0 }
S:0
S:0
S:0
S:0 }

How should i give the key ?

any ideas ?

THX

Chris
Photo of KalleKnall

KalleKnall

  • 3 Posts
  • 0 Reply Likes

Posted 6 years ago

  • 1
Photo of afelicioni

afelicioni

  • 227 Posts
  • 43 Reply Likes
Are you sure? This does just appear to be a logic issue

Are you using a working value for a key instead of using a nonsense my_valid_api_key in your propotype?

Are you trying to query for data features for Freiburg im Breisgau? If so, consider using a string like


Tcpwrite(i , "GET /api/my_valid_api_key/astronomy/q/Germany/Freiburg.json HTTP/1.1{013}{010}" )
Photo of KalleKnall

KalleKnall

  • 3 Posts
  • 0 Reply Likes
Hi,

thx for reply. My API Key is valid. I'll give it a try with GERMANY.

Bye

Chris
Photo of KalleKnall

KalleKnall

  • 3 Posts
  • 0 Reply Likes
Hi,

missing key again.

I think its a problem to connect to apaches virtual host via the IP-adresse.

Chris
Photo of afelicioni

afelicioni

  • 227 Posts
  • 43 Reply Likes
Just tried to telnet api.wunderground.com 80 and a "flat" request
GET /api/KEYGOESHERE/astronomy/conditions/q/Germany/Freiburg.json HTTP/1.1

Host: api.wunderground.com
works

Can you redirect the http request via sort of proxy to monitor requests (like job done with Fiddler2 in windows or Charles in macos)
-or-
if you own a webserver (like a name base virtualhost in apache) and you can watch logs, can you redirect temporarily your requests to this one; so you can spot the resource URL that the device is calling, and if it is right.

Otherwise I don't think WU will officially keep the api access open binded to the same IP for long term; anyway you can connect to 38.102.136.138 and do just


Tcpwrite(i , "GET /api/KEYGOESHERE/astronomy/q/Germany/Freiburg.json HTTP/1.0{013}{010}" )

Please note the HTTP/1.0