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

Re: Simple http_url_post example please



   Hello Jakob,
   If you can't find a *CMD in LIBHTTP, then you may have an outdated
   version of HTTPAPI installed.  The command was added in a recent
   release.
   Here's an example:
   HTTPAPI REQTYPE(*POST) URL('[1]http://test.domain.com/users/')
   DOWNLOAD('/tmp/result.txt') UPLOAD('/tmp/postdata.txt')
   (You put the string '[2]username=NewUser&email=NewUser@xxxxxxxx' in the
   file named /tmp/postdata.txt in the IFS.)
   Does that help?

   On 9/14/2012 4:57 AM, Jakob Zander wrote:

   Hi,
   Thank you for your fast reply!
   First of all, disregard my first example, it was a bad one. I just want
   to do a POST with some data, as given example, from the AS400:
   curl -v -X POST -d '[3]username=NewUser&email=NewUser@xxxxxxxx'
   test.domain.com/users
   I think my biggest problem is that I am not a RPG programmer, and
   therefore find it difficult to understand the examples .
   A *CMD interface sounds great, where can I find information about it?
   Can't find it in LIBHTTP.
   Regards,
   Jakob
   From:        Scott Klement [4]<sk@xxxxxxxxxxxxxxxx>
   To:        HTTPAPI and FTPAPI Projects [5]<ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
   Date:        09/14/2012 10:34 AM
   Subject:        Re: Simple http_url_post example please
   Sent by:        [6]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     __________________________________________________________________

   Hi Jakob,
   In order to help you, I think we need to understand what's lacking in
   the existing examples?   After all, if I were to write a new one, it'd
   probably look pretty much like those old ones.
   Also, FWIW, the two examples you gave do completely different things.
   The first one ("normal world") passes HTML form data as part of the
   URL,
   and then sends 0 bytes of POST data.   The receiving application would
   need to know to look for the data in the QUERY_STRING, since it won't
   be
   found in the POST data.  For an instance like this, it would be far
   more
   intuitive to use GET instead of POST, since you're not sending any POST
   data.
   The second example ("curl") sends the data in the POST data rather than
   the URL.
   An application that can handle both of your examples would need to be
   carefully coded, since it would have to check two input sources for the
   data.  (But... I have, indeed, seen many web apps that do exactly
   that.)
   At any rate, I don't understand where you're struggling with the
   examples.  Maybe the *CMD interface would be easier for you?
   -SK
   On 9/14/2012 2:46 AM, Jakob Zander wrote:
   >     Hi,
   >     First of all, I am no RPG programmer, but I need to implement a
   simple
   >     REST consuming services in ILE RPG.
   >     I've looked through the given examples and tried to alter some to
   my
   >     needs but without luck.
   >     How do I solve this in a simple minimal way?
   >     In the "normal world" I would just POST to an url, like this.
   >     [7]test.domain.com/users/?username=NewUser&email=NewUser@xxxxxxxx
   >     Or with curl:
   >     curl -v -X POST -d '[8]username=NewUser&email=NewUser@xxxxxxxx'
   >     test.domain.com/users
   >     How is this done with HTTPAPI? How to I use http_url_post? A full
   >     example would be great!
   >     Best regards,
   >     Jakob
   >
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [1][9]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------

References

   1. [10]http://www.scottklement.com/mailman/listinfo/ftpapi


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

References

   1. http://test.domain.com/users/
   2. mailto:username=NewUser&email=NewUser@xxxxxxxx
   3. mailto:username=NewUser&email=NewUser@xxxxxxxx
   4. mailto:sk@xxxxxxxxxxxxxxxx
   5. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   6. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   7. mailto:test.domain.com/users/?username=NewUser&email=NewUser@xxxxxxxx
   8. mailto:username=NewUser&email=NewUser@xxxxxxxx
   9. http://www.scottklement.com/mailman/listinfo/ftpapi
  10. http://www.scottklement.com/mailman/listinfo/ftpapi
  11. 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
-----------------------------------------------------------------------