ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Send Receive from REST APIs via RPGLE

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

  • Send Receive from REST APIs via RPGLE

    I'm trying to wrap my head around RPGLE calling REST APIs with POST PUT GET DELETE etc. Just want to know if this is the only resource out there for this and if it's still upto standards and best practices. If you have any other resources I'll appreciate it 100x. I just feel this one pager is an overload of info for someone who has no experience with REST APIs.

    Also, I don't see in the link how it sends and receives JSON. So the link doesn't include topics such as Swagger/Json/Yajl/etcc where to start?

  • #2
    Well unless the browser is hiding something from me you forgot to tell us what "resource" you were currently using! So it is kind of difficult to comment.

    There are a multitude of options ranging from fee to free. IBM's own IWS tooling provides tools for providing ad consuming REST APIs. Scott Klement's HTTPAPI is used by hundreds, If not thousands, of shops for consuming SOAP and REST APIs. There are also other offerings out there. For example SQL on IBM i provides for consuming REST services. PHP, Python, node.js, Java, etc. etc. can all be used and can all be invoked from RPG.

    So ... where are you looking now and where are you going? With that we can make better suggestions.

    Comment


    • #3
      Originally posted by JonBoy View Post
      Well unless the browser is hiding something from me you forgot to tell us what "resource" you were currently using! So it is kind of difficult to comment.

      There are a multitude of options ranging from fee to free. IBM's own IWS tooling provides tools for providing ad consuming REST APIs. Scott Klement's HTTPAPI is used by hundreds, If not thousands, of shops for consuming SOAP and REST APIs. There are also other offerings out there. For example SQL on IBM i provides for consuming REST services. PHP, Python, node.js, Java, etc. etc. can all be used and can all be invoked from RPG.

      So ... where are you looking now and where are you going? With that we can make better suggestions.
      Hi JoyBoy,

      I'm working on a system that's currently using the AxisC + Yajl approach written by Jim Buck back in 2018. There's a new requirement for another part of the system and it's to be written from scratch. Since I knew nothing of Rest Apis and such before reading Jim's code I leaned towards this approach as I thought it was best practice as it was written by Jim himself. I want to know is what is the best practice when dealing with REST APIs from IBM i? Is Scott's HTTPAPI the best practice? Or is it AxisC which is on IBM's website. At the moment I'd like to stay very far away from using other languages that requires some form of installation like Python and etc.

      I know there's almost infinite ways from point A to point B, but I'd like to know best practice so I know I'm doing the correct thing

      Comment


      • #4
        Personally I would use Scott's HTTPAPI if only because of the rich number of examples he supplies, the availability of support through his mailing list and on forums like this, and because if your company wants/needs a support contract Profound Logic will write one for this software.

        I didn't realize until I explored it that when you say AxisC you are really talking about IBM's IWS tooling and calling the stubs it generates. I've never been a huge fan because to me it over complicates things and was clearly not written with RPGers in mind. HTTPAPI is pure RPG - no C stubs just raw RPG and it works very well.

        Check out HTTPAPI at http://scottklement.com/httpapi/ and you can find a presentations that explains some of its functionality here:





        You'll also find Scott's complete workshop on web services on the same page.

        Comment


        • #5
          Oh, I see... ":Jim himself" recommended AxisC. Well, since I'm nobody, I guess I can't argue with that.

          Comment


          • #6
            Originally posted by Scott Klement View Post
            Oh, I see... ":Jim himself" recommended AxisC. Well, since I'm nobody, I guess I can't argue with that.
            NO NO. Not like that! It's just that I'm reading on Jim's book on RPGLE so I thought there must be a reason why he's using AxisC. AFAIK You're both legends please

            Comment


            • #7
              Use HTTPAPI + YAJL. It makes things very easy and can handle a lot of different situations. Depending on your needs, I'm sure a few of us could post some basic code to get you started.

              I've also used httpPostClob() instead of HTTPAPI, but ran into issues when the same job also ran Java code. JonBoy may have helped me with that issue.
              Your friends list is empty!

              Comment


              • #8
                Originally posted by mjhaston View Post
                Use HTTPAPI + YAJL. It makes things very easy and can handle a lot of different situations. Depending on your needs, I'm sure a few of us could post some basic code to get you started.

                I've also used httpPostClob() instead of HTTPAPI, but ran into issues when the same job also ran Java code. JonBoy may have helped me with that issue.
                Thanks I'm gonna try this as well. Currently focused on making HSSFR4 from Scott to work in PUB400. Then I'm going to make HTTPAPI work

                Comment


                • JonBoy
                  JonBoy commented
                  Editing a comment
                  As part of the YAJL package you'll also have YAJLINTO which with DATA-INTO makes it even easier to process JSON than straight YAJL in many cases.

                • Luigi Brito
                  Luigi Brito commented
                  Editing a comment
                  My mind is gonna blow up from too much reading haha. Thanks JonBoy I'll look into that as well
              Working...
              X