Programming Languages on Power

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power

 View Only
Expand all | Collapse all

DB2 SQL HTTP_GET/POST

  • 1.  DB2 SQL HTTP_GET/POST

    Posted Wed April 15, 2026 12:56 PM

    Does anyone have a SQLRPGLE program which is accessing FedEx or UPS using QSYS2.HTTP_ that they would be willing to share with me or by posting? I need to retrieve an authorization token from FedEx and UPS and I'm not sure if I should be using the QSYS2.HTTP_GET or the QSYS2.HTTP_POST. I've been trying and failing with UPS using both GET and POST. I will also need to do the same with FedEx in the future. Any help would be appreciated. Thanks.



    ------------------------------
    Doug Freeman
    ------------------------------


  • 2.  RE: DB2 SQL HTTP_GET/POST

    Posted Wed April 15, 2026 03:09 PM

    I don't have a ready made solution for you, but maybe some tips.

    First - it will not be easy. IBM i is an EBCDIC system, and the rest of the world is "speaking" UTF-8. RPGLE is awesome with UTF-8, but using embedded SQL with UTF-8 back and forth between is not for the faint of heart. Be ready to have some frustrating moments.

    Start with a tool like Postman to explore the APIs of FedEx and UPS - especially the methods GET or POST - if you have your requests ready in Postman, it shouldn't be so hard, to recreate those requests with SQL.

    The next step is, to try those requests with embedded SQL in RPGLE.

    If your frustration is getting to hard, contact me - I can try to help.

    Regards,
    Daniel



    ------------------------------
    Daniel Gross
    #IBMChampion
    Senior Core Developer, Geis Group
    Pegnitz, Germany
    https://blog.qpgmr.de/
    ------------------------------



  • 3.  RE: DB2 SQL HTTP_GET/POST

    Posted Tue April 28, 2026 09:40 AM

    Hi Daniel,

    Thank you for responding. You were correct about the frustration. But I finally got the QSYS2.HTTP_POST to work in a SQLRPGLE. 



    ------------------------------
    Doug Freeman
    ------------------------------



  • 4.  RE: DB2 SQL HTTP_GET/POST

    Posted Tue April 28, 2026 09:59 AM
    Oh I can really relate ... sitting here on day 2 working on a new API that our web guys created - and really getting more grey hair every other hour. The EBCDIC vs. UTF8 thing can be frustrating - but it gets really frustrating if you have to deal with BLOBs that should be sent or received over the web.

    But the SQL functions are cool - I haven't touched any RPG code so far, and have about 90% running. Moving this into SQLRPGLE will be really easy - but first it has to run for 100%.

    I try to blog regularly about things like the UPS API that you got running - but I don't have an UPS account. So would you mind, if "we" (I can do that) put your code (of course without account/tokens/etc) into a blog post? So that others might not have such a hard time to get it running?

    If you want to- just send mit a PM - maybe with your code (but please remove personal data) - and I would write up some additional text.

    Regards,
    Daniel




  • 5.  RE: DB2 SQL HTTP_GET/POST

    Posted Tue April 28, 2026 10:21 AM

    I've been watching this thread and am glad to see the community pull together to help each other. It's also good to see that others are using the HTTP functions to help modernize their programs on the "i".

    If any of you would like to see enhancements to the HTTP functions to facilitate logging, I'd ask that you up-vote this request: https://ibm-power-systems.ideas.ibm.com/ideas/IBMI-I-4866

    I often use axiscAxisStartTrace() to see what's happening but with this idea/enhancement I'm asking that the trace options are added to the functions so it's all unified. Thanks for your consideration on this topic.



    ------------------------------
    David Miller
    ------------------------------



  • 6.  RE: DB2 SQL HTTP_GET/POST

    Posted 29 days ago

    Hi Daniel,

    I reached out to you and can send my source to you. The source retrieves a UPS authorization token. Let me know. Thanks, Doug.



    ------------------------------
    Doug Freeman
    ------------------------------



  • 7.  RE: DB2 SQL HTTP_GET/POST

    Posted 29 days ago
    Hi Doug,

    this sounds great - I would try to write something up, so other may find it helpful.

    I accepted the contact request already - so you should be able to send me a PM.

    Thanks in advance
    Daniel




  • 8.  RE: DB2 SQL HTTP_GET/POST

    Posted Thu April 16, 2026 02:27 AM

    It is always handy to read the documentation ;-)

    API Authorization Documentation | FedEx Developer Portal

    Here you can see the required parameters, method (POST) and return values.



    ------------------------------
    Paul Nicolay
    Architect
    Cegeka
    ------------------------------



  • 9.  RE: DB2 SQL HTTP_GET/POST

    Posted Tue April 28, 2026 09:43 AM

    Hi Paul,

    Thank you for responding. I had failed so many times using POST that I had almost convinced myself that I should be using something besides POST.



    ------------------------------
    Doug Freeman
    ------------------------------



  • 10.  RE: DB2 SQL HTTP_GET/POST

    Posted Fri April 17, 2026 11:07 AM

    What have you been trying, and what exactly does "failing" look like?
    Do you have a working example anywhere (i.e. Postman)?
    I assume you are trying to use the client credentials grant ... https://developer.ups.com/tag/OAuth-Client-Credentials?loc=en_US

    When I do this, I usually start with Postman. 
    Once that's working I use Run SQL Scripts. 
    Only then do I stick it into my RPG program.



    ------------------------------
    Patrick Behr
    Senior Consultant
    Seiden Group
    OR
    ------------------------------



  • 11.  RE: DB2 SQL HTTP_GET/POST

    Posted Fri April 17, 2026 12:34 PM

    Hi Patrick,

    I sent you a private reply with my source program, UPS response, etc.

    Please let me know if you did not receive it. Thanks, Doug.



    ------------------------------
    Doug Freeman
    ------------------------------



  • 12.  RE: DB2 SQL HTTP_GET/POST

    Posted Tue April 28, 2026 09:35 AM

    Hi Patrick,

    I wanted to thank you for your suggestions. I did get the QSYS2.HTTP_POST to retrieve an authorization token from UPS. My main issue was my credentials were not base64 encoded. Thanks again.



    ------------------------------
    Doug Freeman
    ------------------------------