Cross posting from Midrange list .. .
We are on IBM I V7R2. I am using ACS SQLScripts v. 1.1.7.2
I am attempting to use httpgetclob and json_table to go to a vendor's (GetResponse), rest API.
I have tested the API in RPG usinig SK's LIBHTTP and it works like a charm.
However, when attempting it via an ACS SQL session using HTTPGETCLOB it is failing.
Here is the statement:
select * from JSON_TABLE(
SYSTOOLS.HTTPGETCLOB('
https://api3.getresponse360.com/v3/contacts?query[email]=@worldnet.att.net'
,'Content-Type: application/json
X-Auth-Token: api-key 5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3
X-Domain: email.ourdomain.com'
),'$'
Columns(contactid varchar(4) PATH 'lax $.contactid',
email varchar(100) PATH 'lax $.email',
changedOn varchar(20) PATH 'lax $.changedOn',
createdOn varchar(20) PATH 'lax $.createdOn')
) as t ;
I am getting this error:
SQL State: 38000
Vendor Code: -4302
Message: [SQL4302] Java stored procedure or user-defined function SYSTOOLS.HTTPGETCLOB, specific name HTTPG00005 aborted with an exception "Content is not allowed in prolog."
I am thinking that header statements:
'Content-Type: application/json
X-Auth-Token: api-key 5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3
X-Domain: email.ourdomain.com'
are somehow causing the error and this is possibly a formatting issue.
1. Is there something obviously wrong with my statement?
2. Is there a debugging option I can turn on in the ACS SQL client to help me debug HTTPGETCLOB? I would love to determine the issue via my own resources if possible.
3. Perhaps HTTPGetClob is not what I really want to do?
Any and all help appreciated.
Paul
As an Amazon Associate we earn from qualifying purchases.