HTTPAPI is an IBM i library (LIBHTTP) containing a full set of API’s allowing any IBM i programmer to write webservices to read, write and tinker (those are technical terms) with cloud based applications. For example, you could use the HTTPAPI library to easily add some code to an RPG program, letting you validate a USPS postal address in real time (by calling the GOOGLE address validation webservice).
HTTPAPI is written by Scott Klement and is Open Source.
I’m a huge fan of Scotts’s excellent API interface for talking to webservices. It makes the whole thing so simple, it feels transparent. It comes with a handful of sample RPGLE code snippets to let you easily grasp the concepts of making an existing RPG program easily talk to something out there on the internet, or out there on a server in your company network.
IBM i (OS/400) version 6.1 or later.
ILE RPG compiler.
To use SSL, you must install the Digital Certificate Manager, the HTTP server and one of the IBM Cryptographic Access provider licensed programs. Certain PTFs are also required. See the README file in the distribution for details
Download HTTP API distribution and save it to your PC — or to IBM i (directly into the SAVF.)
Log onto IBM i, and create a save file to store the distribution in.
To do this, type:
If you sent it to your PC, FTP the distribution from your PC to IBM i.
To do this:
Open an MS-DOS Prompt.
Type: cd \directory\where\you\put\httpapi.savf
Type: ftp your-ibmi-name-here
Type: (enter your username & password when asked)
Type: binaryType: put httpapi.savf QGPL/HTTPAPI
If you are unable to use FTP for any reason, you can try this IFS technique using IBM i ACS. Many companies block the FTP ports for uploading objects to your IBM i System and I’ve used this little work around many times:
IBM i ACS > ACTIONS > INTEGRATED FILE SYSTEM
Select SAVF from \download and upload to \home\username (where this folder is your folder of choice)
Once uploaded you can use the CPY command to copy this uploaded SAVF into the QGPl/SAVF you created earlier. This will convert it from PC format to to IBM i format:
FROMCCSID(PCASCII) TOCCSID(37) REPLACE(YES)
Back on IBM i, type:
DLTLIB LIBHTTP (ignore errors if library doesnt exist)
RSTLIB SAVLIB(LIBHTTP) DEV(*SAVF) SAVF(QGPL/HTTPAPI)
Build & run the install program:
CRTCLPGM INSTALL SRCFILE(LIBHTTP/QCLSRC)
The install program will guide you through the rest of the process.
Just in case Scott’s website is every offline here is a mirror of the Jan 2020 IBMi7.2 implementation of HTTPAPI
IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.
Developerworks Connections Sunset – How to Extend RDi
Why use IBM i RDi?
How can I learn Microsoft MS Project 2010
How to upgrade from YOAST to Rank Math SEO
WordPress 5.3 upgrade error with Thrive Architect
Copying iSeries fields from numeric to Alpha – aka using SQL to change column data type
What is IBM i Email and SPF?
Updating Numeric DTAARA in RPGLE
How to capture IBM-i job info for submitted jobs