×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I'm sure something like HTTPGETCLOB would do it (
https://www.itjungle.com/2017/09/18/guru-consuming-rest-web-service-using-sql-get/).
As a side note, if you have it working in Python why do you need to change?
-----Original Message-----
From: Roger Harman [mailto:roger.harman@xxxxxxxxxxx]
Sent: Wednesday, March 27, 2019 4:47 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: SQL HTTP Function to get a text file from web service
I have a Python script that downloads a text file from a web service. Looks like this:
response = requests.get(
url="https:<the url>",
headers={
"Accept": "text/tab",
"API-TOKEN": "<the token>",
"SITE-USER": "<the user>",
"user-agent": "<the agent>",
}
)
with open(TxtFileName, 'wb') as outputFile:
outputFile.write(response.content)
outputFile.close()
Is this easily replicated using one of the SQL HTTP functions? After download we put in a PF and feed a downstream process.
I feel like I should be able to figure this out but I'm just... stumped.
Thanks!!
Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power
As an Amazon Associate we earn from qualifying purchases.