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

Re: How to build HTTPS header using GET



   Hi Alan,
   The Soap Action parameter is only for Soap Action.  It cannot be used
   for Unix command line parameters.  Please understand that this is
   neither Unix nor a command-line... and even if it were, it would not be
   the Soap Action parameter where such a thing would be used...
   HTTPAPI provides an exit point that can be used to send additional HTTP
   headers if that is what you're trying to do?
   http_xproc registers a subprocedure of your own that will be called
   while HTTPAPI is sending HTTP headers.  It will stop in the middle of
   it's processing, call your subprocedure to get additional header
   information, and then will send whatever you specify as an HTTP
   header.  It does not check the syntax of your headers, it is up to you
   to make sure you get it right.
          http_xproc( HTTP_POINT_ADDL_HEADER
                    : %paddr(MyProcedure) );
   So the above code is called before you call http_url_get().  When the
   http_url_get() routine is running, it will see that this is registered
   and stop and call the (in this example) MyProcedure subprocedure.  Of
   course, you can call the procedure whatever you like, as long as you
   pass the appropriate name in the above code.
   The procedure should work like this:
   P MyProcedure     B
   D                 PI
   D  header                    32767a   varying
    /free
       header = 'Authorization: Bearer #token' + x'0d25';
    /end-free
   P                 E
   I'm assuming the string #token is just a placeholder, and that you
   already have written the appropriate cryptographic routines to supply
   the actual token.  I have not implemented OAuth security in HTTPAPI, so
   it will be up to you to calculate the proper token.
   On 10/25/2013 10:19 AM, Alan Matautia wrote:

   I'm trying to access our website to retrieve data using the HTTPAPI.
   I'm passing a parameter for the security token (#token) and I'm using
   the REST API.  I don't receive any errors when I call my RPGLE program
   and no data is retrieve.  Does anyone know how to build a HTTPS header
   for the GET?
   Here's my code:
   rc = http_url_get(
   '[1]https://my.website.com/services/apexrest/v1/order/all'
   :'/tmp/orders/orderdata.txt'
   :0
   :*omit
   :*omit
   :*omit
   :'-H Authorization: Bearer ' +
   #token);
   Thank you
   AM


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

References

   1. https://my.website.com/services/apexrest/v1/order/all
   2. 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
-----------------------------------------------------------------------