As a 2nd for using curl, check out the QSHEXEC command to front end your QSH and PASE calls from RPG or CL. It's free and open source.
https://github.com/richardschoen/QshOni
QshOni
This IBM i library contains useful CL wrapper commands to allow Qshell and Pase apps to be called and consumed from regular IBM i jobs via CL, RPG or COBOL programs. It also has a CL command to scan stdout for a specific value if you need to do something simple to check for a successful command run.
The main benefit of this wrapper is to be able to integrate Qshell/Pase applications on-the-fly with standard IBM i job streams.
QSHONI/QSHEXEC CMDLINE('curl --request POST --url +
https://xxxxx.com/token +
--header "accept: application/json" +
--header "authorization: Basic +
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+
--data "{\"xxxxx_xxxx\": +
\"client_credentials\"}" -k > +
/tmp/token.txt') SETPKGPATH(*YES)
The SETPKGPATH parm will set the path to the Yum packages from IBM as well as the multithreading.
You can also monitor for an error on the command if the QSH/PASE command fails and can write STDOUT results to an IFS file, OUTFILE, JOBLOG or Spool File.
Great for incorporating those QSH/PASE commands such as curl into standard batch jobs.
Regards,
Richard Schoen
Web:
http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx
----------------------------------------------------------------------
message: 1
date: Fri, 6 Nov 2020 10:33:23 +0100
from: Patrik Schindler <poc@xxxxxxxxxx>
subject: Re: RPGLE API : How can I download images or PDF's from a
website to my AS400
Hello Kris,
Am 06.11.2020 um 10:29 schrieb Kris Chantry <kris.chantry@xxxxxxxxx>:
Is there an API or an easy way that we can DOWNLOAD or RETRIEVE those
images from his website on to our IFS ?
Depending on the Version of IBM i|i5/OS|OS/400, you can install cURL in PASE and use this as a callable command from within QSH. Keep in mind that normally, you give an URL like
http://www.google.com/image01.jpg (or https), not just the server name.
:wq! PoC
As an Amazon Associate we earn from qualifying purchases.