QSYS2.HTTP_GET
Posted: Thu May 16, 2024 2:23 pm
Here is the curl request that works
curl -X 'GET' \
'https://myfullurlhere' \
-H 'accept: text/plain' \
-H 'X-API-Key: myapikey'
The code is RPGLE **FREE
I am trying to use the SQL functions so here is how i set up my options
exec sql values json_object(
'basicAuth' value 'X-API-Key: myapikey',
'header' value 'accept: text/plain'
)
into :options;
then my call
exec SQL
values QSYS2.HTTP_GET(:urlRest, :options)
into :response;
This causes 38501 SQL error. Which isn't very useful in figuring out what is wrong.
Any ideas how to make this work?
Thanks, Kita
I've tried many versions of the options but nothing seems to work correctly and I always get the 38501 SQL error.
The error in the joblog is as follows.
Additional Message Information
Message ID . . . . . . : CPF503E Severity . . . . . . . : 30
Message type . . . . . : Sender copy
Date sent . . . . . . : 05/16/24 Time sent . . . . . . : 10:09:01
Message . . . . : User-defined function error on member QSQPTABL.
Cause . . . . . : An error occurred while invoking user-defined function
HTTP_GET in library QSYS2. The error occurred while invoking the associated
external program or service program QSQAXISC in library QSYS, program entry
point or external name axiscGetClob, specific name HTTP_GET. The error
occurred on member QSQPTABL file QSQPTABL in library QSYS2. The error code
is 1. The error codes and their meanings follow:
Thank you in advance.
Kita
curl -X 'GET' \
'https://myfullurlhere' \
-H 'accept: text/plain' \
-H 'X-API-Key: myapikey'
The code is RPGLE **FREE
I am trying to use the SQL functions so here is how i set up my options
exec sql values json_object(
'basicAuth' value 'X-API-Key: myapikey',
'header' value 'accept: text/plain'
)
into :options;
then my call
exec SQL
values QSYS2.HTTP_GET(:urlRest, :options)
into :response;
This causes 38501 SQL error. Which isn't very useful in figuring out what is wrong.
Any ideas how to make this work?
Thanks, Kita
I've tried many versions of the options but nothing seems to work correctly and I always get the 38501 SQL error.
The error in the joblog is as follows.
Additional Message Information
Message ID . . . . . . : CPF503E Severity . . . . . . . : 30
Message type . . . . . : Sender copy
Date sent . . . . . . : 05/16/24 Time sent . . . . . . : 10:09:01
Message . . . . : User-defined function error on member QSQPTABL.
Cause . . . . . : An error occurred while invoking user-defined function
HTTP_GET in library QSYS2. The error occurred while invoking the associated
external program or service program QSQAXISC in library QSYS, program entry
point or external name axiscGetClob, specific name HTTP_GET. The error
occurred on member QSQPTABL file QSQPTABL in library QSYS2. The error code
is 1. The error codes and their meanings follow:
Thank you in advance.
Kita