[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Stumped By Simple Task
Hi Scott
Thank you for the reply. It's just what I'm looking for.
At this point, I would like give a helpful hint to any future poster
.... Look in libhttp/qrpglesrc for examples using HTTPAPI.
I found this source code this morning and I'm working through
them. Scott already anticipated the questions and provided the answers
too!
> From: ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Ftpapi Digest, Vol 73, Issue 1
> To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
> Date: Mon, 2 Jul 2012 12:00:02 -0500
>
> Send Ftpapi mailing list submissions to
> ftpapi@xxxxxxxxxxxxxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://scottklement.com/mailman/listinfo/ftpapi
> or, via email, send a message with subject or body 'help' to
> ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx
>
> You can reach the person managing the list at
> ftpapi-owner@xxxxxxxxxxxxxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Ftpapi digest..."
>
>
> Today's Topics:
>
> 1. FW: Stumped By Simple Task (w 4038)
> 2. Re: FW: Stumped By Simple Task (Scott Klement)
>
>
>
----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 1 Jul 2012 17:01:09 -0400
> From: w 4038 <window4038@xxxxxxxx>
> To: FTPAPI <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
> Subject: FW: Stumped By Simple Task
> Message-ID: <BLU116-W19A3701E11899608A33655A0EB0@xxxxxxx>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
>
>
>
>
>
>
>
> Hi
> I've used Scott's HTTPAPI tool to get the weather, currency and UPS
package information to the AS400. (Thanks Scott for writing the
articles showing how to do this.)
>
> In comparison to those examples, I have what seems to be a very
simple task, but I don't see how the HTTPAPI tool can accomplish it.
>
> Scott's articles show you how to use WSDL and SOAP to form a web
request, retrieve the reply and then parse it. But what if your vendor
doesn't use WSDL or SOAP?
>
> Currently, we store documents in the "cloud" on a vendor's site. In
order to delete a document, the vendor's instructions show a simple
request like:
> https://dmapi.com/user="username"&id="id"&doc="1234"
>
> This returns a session id. With that session id, you can then delete
the document by issuing another simple request:
> https://dmapi.com/session=sessionid&action="delete"
>
>
> Should I use HTTPAPI to issue simple requests like that? Or am I
trying to use the wrong tool?
>
> Thank you
>
>
> -------------- next part --------------
>
> __________________________________________________________________
>
> Hi
> I've used Scott's HTTPAPI tool to get the weather, currency and UPS
> package information to the AS400. (Thanks Scott for writing the
> articles showing how to do this.)
>
> In comparison to those examples, I have what seems to be a very
simple
> task, but I don't see how the HTTPAPI tool can accomplish it.
>
> Scott's articles show you how to use WSDL and SOAP to form a web
> request, retrieve the reply and then parse it. But what if your
vendor
> doesn't use WSDL or SOAP?
>
> Currently, we store documents in the "cloud" on a vendor's site. In
> order to delete a document, the vendor's instructions show a simple
> request like:
> https://dmapi.com/user="username"&id="id"&doc="1234"
>
> This returns a session id. With that session id, you can then delete
> the document by issuing another simple request:
> [1]https://dmapi.com/session=sessionid&action="delete"
>
>
> Should I use HTTPAPI to issue simple requests like that? Or am I
> trying to use the wrong tool?
>
> Thank you
>
> References
>
> 1. https://dmapi.com/session=sessionid%26action=%22delete
>
> ------------------------------
>
> Message: 2
> Date: Mon, 02 Jul 2012 00:01:23 -0500
> From: Scott Klement <sk@xxxxxxxxxxxxxxxx>
> To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
> Subject: Re: FW: Stumped By Simple Task
> Message-ID: <4FF12B23.5020501@xxxxxxxxxxxxxxxx>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hello W,
>
> If your parameters are already URL encoded, it's as simple as doing
> something like this:
>
> H DFTACTGRP(*NO) ACTGRP('KLEMENT')
> H BNDDIR('HTTPAPI') OPTION(*SRCSTMT)
>
> /copy httpapi_h
>
> D url s 500a varying
> D rc s 10i 0
> D stmf s 1024a varying
>
> /free
> url = 'https://dmapi.com/user="username"&id="id"&doc="1234"';
> stmf = '/tmp/output.txt';
>
> rc = http_get( url: stmf );
> if rc <> 1;
> http_crash();
> endif;
>
> *inlr = *on;
>
>
> If you need HTTPAPI to URL-encode them for you, then you'll want to
ask
> HTTPAPI to build you a web form, and add each variable to it. The
> result should look something like this:
>
> H DFTACTGRP(*NO) ACTGRP('KLEMENT')
> H BNDDIR('HTTPAPI') OPTION(*SRCSTMT)
>
> /define WEBFORMS
> /copy httpapi_h
>
> D UserId s 64a varying inz('"username"')
> D Id s 64a varying inz('"id"')
> D doc s 10a varying inz('"1234"')
> D form s like(WEBFORM)
> D url s 500a varying
> D rc s 10i 0
> D stmf s 1024a varying
>
> /free
> // Build a URL-Encoded Form
>
> form = WEBFORM_open();
> WEBFORM_setVar( form: 'user': %trim(UserId));
> WEBFORM_setVar( form: 'id' : %trim(Id));
> WEBFORM_setVar( form: 'doc' : %trim(doc));
> url = 'https://dmapi.com/' + WEBFORM_getData(form);
> WEBFORM_close(form);
>
> // Send a GET request with form data in the URL:
>
> stmf = '/tmp/output.txt';
> rc = http_get( url: stmf );
> if rc <> 1;
> http_crash();
> endif;
>
> *inlr = *on;
>
> Hope that helps.
>
>
>
> On 7/1/2012 4:01 PM, w 4038 wrote:
> > Hi
> > I've used Scott's HTTPAPI tool to get the weather, currency and UPS
> > package information to the AS400. (Thanks Scott for writing the
> > articles showing how to do this.)
> >
> > In comparison to those examples, I have what seems to be a very
simple
> > task, but I don't see how the HTTPAPI tool can accomplish it.
> >
> > Scott's articles show you how to use WSDL and SOAP to form a web
> > request, retrieve the reply and then parse it. But what if your
vendor
> > doesn't use WSDL or SOAP?
> >
> > Currently, we store documents in the "cloud" on a vendor's site. In
> > order to delete a document, the vendor's instructions show a simple
> > request like:
> > https://dmapi.com/user="username"&id="id"&doc="1234"
> >
> > This returns a session id. With that session id, you can then
delete
> > the document by issuing another simple request:
> > https://dmapi.com/session=sessionid&action="delete"
> >
> >
> > Should I use HTTPAPI to issue simple requests like that? Or am I
> > trying to use the wrong tool?
> >
> > Thank you
> >
>
>
>
> ------------------------------
>
>
-----------------------------------------------------------------------
> This is the FTPAPI mailing list digest. To unsubscribe, go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
>
-----------------------------------------------------------------------
>
>
> End of Ftpapi Digest, Vol 73, Issue 1
> *************************************
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------