[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Wunderground REST format



Hi,

I know it's been a while but I wanted you to know I got this to work, and to thank you for providing the blueprint for this! 

It turns out the iseries tech and the network/firewall tech had to collaborate to open this up properly.

Bill Zader
Team Leader, Application Support 
(RAF, MRO, XMS, Irista, CribMaster, Infor, ClearOrbit)

Exel
260 Salem Church Road
Mechanicsburg, PA 17050 USA

Office: 717-901-1091
Cell: 717-982-1001
Fax: 717-901-1733

www.exel.com


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Friday, March 13, 2015 4:10 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Wunderground REST format

The hostname lookup is probably because you have a trailing space in the hostname?  Either that, or you don't have DNS resolution configured in the network settings of your box.

Also, I don't understand why you're doing a POST request.    Why not a 
GET request??

Here's a really quick attempt (you'll have to fill in your own API key):

      H DFTACTGRP(*NO) BNDDIR('HTTPAPI')

       /copy httpapi_h

      D WUNDERTEST      PR                  ExtPgm('WUNDERTEST')
      D   State                        2a   const
      D   City                        32a   const
      D WUNDERTEST      PI
      D   State                        2a   const
      D   City                        32a   const

      D url             s           1000a   varying
      D rc              s             10i 0
      D len             s             10i 0
      D result          s          65535a   varying
      D KEY             c                   'put-your-key-here'

      D response        ds                  qualified
      D   weather                     20a   varying
      D   temp                        20a   varying

       /free

         url = 'http://api.wunderground.com/api/'
            + KEY + '/conditions/q/'
            + %trim(State) + '/'
            + %trim(City) + '.xml';

         result = '';

         // get data from wunderground:

         rc = http_get_xml( url
                          : *null
                          : %paddr(getWeather)
                          : %addr(response) );
         if rc < 1;
            http_crash();
         endif;

         dsply (response.weather + ' ' + response.temp);

         *inlr = *on;
       /end-free


      P getWeather      B
      D                 PI
      D   resp                              likeds(response)
      D   depth                       10i 0 value
      d   name                      1024a   varying const
      D   path                     24576a   varying const
      D   value                    32767a   varying const
      D   attrs                         *   dim(32767)
      D                                     const options(*varsize)
       /free
         select;
         when name = 'weather';
            resp.weather = value;
         when name = 'temperature_string';
            resp.temp = value;
         endsl;
       /end-free
      P                 E


On 3/13/2015 2:25 PM, Bill Zader (Exel US) wrote:
> Hi.  Thanks for getting back to me.
>
> I took a wild guess at what to do using REST format and their .JSON call.
>
> I am receiving a 'Host name look up failed.' error message return in the http_error field.
>
> My parms are below:
> rc = http_url_post_xml('http://api.wunderground.com +
>       /api/(mykey)/conditions/q/17112.json'
>                        : *NULL
>                        : 0
>                        : %paddr(StartOfElement)
>                        : %paddr(EndOfElement)
>                        : *NULL );
>
> Heck it might be as simple as the fact that I have the "+" within the rc value. Or it hates the fact that I used *NULL and 0.
>
> Bill Zader
> Team Leader, Application Support
> (RAF, MRO, XMS, Irista, CribMaster, Infor, ClearOrbit)
>
> Exel
> 260 Salem Church Road
> Mechanicsburg, PA 17050 USA
>
> Office: 717-901-1091
> Cell: 717-982-1001
> Fax: 717-901-1733
>
> www.exel.com
>
>
> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott 
> Klement
> Sent: Friday, March 13, 2015 3:14 PM
> To: HTTPAPI and FTPAPI Projects
> Subject: Re: Wunderground REST format
>
> I did some proof-of-concept programs with Wunderground ages ago...
> probably 7-8 years ago.   They worked just fine.
>
> Can you tell us more about the problems you're having?
>
>
> On 3/13/2015 12:39 PM, Bill Zader (Exel US) wrote:
>>      Hello,   I am working on a project to retrieve current weather
>>      conditions from wunderground.com.  I was able to use SOAPUI in REST
>>      format and receive results. Now I need to convert the thing to RPG.
>>
>>
>>      Has anyone gotten this to work? If so, I would greatly appreciate how
>>      you did it as this is a daunting task for someone with no web
>>      programming experience.
>>
>>
>>      Thanks in advance.
>>
>>      Bill Zader
>>      Team Leader, Application Support
>>      (RAF, MRO, XMS, Irista, CribMaster, Infor, ClearOrbit)
>>      [1]bill.zader@xxxxxxxx
>>
>> References
>>
>>      1. mailto:bill.zader@xxxxxxxx
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
>> http://www.scottklement.com/mailman/listinfo/ftpapi
>> ---------------------------------------------------------------------
>> -
>> -
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> ----------------------------------------------------------------------
> -
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> ----------------------------------------------------------------------
> -
>

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------