ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

HTTPAPI: http_url_get vs http_url_post

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTPAPI: http_url_get vs http_url_post

    Just wondering what the difference is between these two procedures, and when to use one versus the other.

    I know that one uses the GET method while the other uses the POST method... both seem to work with the web services I'm working with (Amazon AWS). But most of the web service documentation refers to POST.

    Just curious.

    Second question... what is the easiest way to url encode a text string? I know WebForm_setVar() will do that. Is there better method when dealing with a single string of text? Is it necessary when using http_url_get or http_url_post?
    Last edited by gwilburn; September 27, 2016, 09:46 AM. Reason: added a follow up question

  • #2
    The difference is that http_url_get does an HTTP GET request, and http_url_post does an HTTP POST request. I realize that you said you already knew that -- but... that is the difference between them. While AWS might allow either one to be used in this case, that is not true everywhere. Sometimes it matters which one you use.

    The "webform" routines are currently the only way to URL-encode a string in HTTPAPI. I've considered adding something else that just URL-encodes one component (rather than building the whole string) but have not yet done so.

    Whether it's necessary depends on what your data is used for and whether the server requires it.

    Comment


    • #3
      I just read an article in IT Jungle where RPG was talking to IBM Watson... in the sample code, Paul Tuohy used an SQL function in SYSTOOLS to to URL-encode. I may give that a try.

      Code:
      exec SQL
             values trim(systools.urlencode(:str1, '')) into :str2;
      This may only be available on v7r1 or later.

      Comment


      • #4
        gwilburn - did you ever accomplish the AWS webservice? I am tasked with the same. I have done webservices before with http_api and also systools.
        As I am at the very initial stages of being handed this project - would you be generous to provide any code that may help me pursue my task?
        Or if more than anything, an online resource for how to interact/call the AWS webservice?



        Comment

        Working...
        X