× 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 have an api using qsys2.http_post that is working just fine when called
from ACS run sql scripts...

I'm moving it to embedded SQL in RPG and getting the following error when
running...

is 1. The error codes and their meanings follow:
1 -- The external program or service program returned SQLSTATE 38501. The
text message returned from the program is: ERROR : OPTION NOT JSON .

I have converted char for char... it is identical

Here is the embedded sql in rpg...
What is wrong and why am I getting this error?

l_url = 'https://api.twilio.com/2010-04-01/Accounts/'
%trim(l_apiKey)
'/Messages.json';

l_hdr = '{'
'"basicAuth":"'
%trim(l_apiKey) + ','
%trim(l_authToken) + '"'
',"header":"content-type,application/x-www-form-'
'urlencoded"'
',"sslTolerate":"true"'
'}';

l_bdy = '&To=+'
%char(i_phone)
'&From=REDACTED'
'&MessagingServiceSid='
%trim(l_msgSvcId)
'&Body='
%trim(i_msg);

exec sql
select ifnull("error_message",' ')
into :o_errorMsg
from json_table(
qsys2.http_post(:l_url
,cast(:l_hdr as varchar(855))
,cast(:l_bdy as clob(10k))
)
,'$' columns (
"error_message" char(100) path '$.error_message'
) error on error
) as x;

if sqlcode = 0;
return *on;
else;
return *off;
endif;


tia jay

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.