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

Re: Which example fits?



Also might be worth noting that the current beta version of HTTPAPI has 
a command-line tool, both for QShell and native.

So for example you could do the following from CL:

HTTPAPI URL('https://connect.thewebsite.com/extern?+
              account=xxx&username=xxx&password=xxx&+
              lang=de&action=showObjectReportExtern+
              &filterstring=Demo') +
         DOWNLOAD('/tmp/temp.csv')

Personally, I think that's more elegant than using a Unix tool, don't you?

The problem with this (or with the cURL example, or with wget, etc, etc) 
is that there's nothing in the process to properly encode the URL 
encoded values.

Coding it in RPG with the URL encoder may be "harder" (i.e. more code) 
but it'll give you the ability to encode the values properly.

Just my thought.

Either way, you can use CPYFRMIMPF if you don't want to parse the file 
format yourself.

sbramley@xxxxxxxxx wrote:
>    If you have PASE available, have you considered using cURL for this?
>    Once installed and configured all you would need is a normal file to
>    copy the data into and a CL doing something like :-
>    QSH CMD('curl
>    https://connect.thewebsite.com/extern?account=xxx&username=xxx&passwor
>    d=xxx&lang=de&action=showObjectReportExtern&filterstring=Demo >
>    /tmp/temp.csv')
>    CPYFRMIMPF FROMSTMF('/tmp/temp.csv') TOFILE(MYLIB/MYFILE) RCDDLM(*ALL)
>    FLDDLM(';') MBROPT(*REPLACE) FROMRCD(2)
>    Just a thought... saves parsing the returned data yourself..
>    Stu
> 
>    "Smith, Mike" <Mike_Smith@xxxxxxxxxxxxxxxx>
>    Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> 
>    11/02/2010 17:08
> 
>                              Please respond to
>         HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
> 
>                                                                        To
> 
>    <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
> 
>                                                                        cc
> 
>                                                                   Subject
> 
>    Which example fits?
> 
>    I have a request to retrieve data from a vendor.  I'm trying to figure
>    out from their documention  which if any of the examples of Scotts
>    HTTP
>    code is most applicable.
>    I looked at example3 but I don't think that is what I'm looking for.
>    Hopefully this is enough information for someone to guide me in the
>    right direction.
>    Example of how connection is made
>    https://connect.thewebsite.com/extern?
>    account=xxx&username=xxx&password=xxx&lang=de&
>    action=showObjectReportExtern&
>    filterstring=Demo
>    This is how the data is returned.
>    "objectno";"objectname";"objectclassname";"objecttype";"description";
>    "lastmsgid";"deleted"
>    "026";"Demo 1";"Fahrzeug";"";"";"107711249";"0"
>    "027";"Demo 2";"Fahrzeug";"";"";"105985957";"0"
>    "028";"Demo 3";"Fahrzeug";"";"";"107794499";"0"
>    Thanks
>    Mike
>    NOTICE:  This message, including any attachment, is intended as a
>    confidential and privileged communication. If you have received this
>    message in error, or are not the named recipient(s), please
>    immediately notify the sender and delete this message.
>    ----------------------------------------------------------------------
>    -
>    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
-----------------------------------------------------------------------