× 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.



aw man...

sadly but gladly....

you are right!

all is well now.

thanks!

On Wed, Nov 23, 2022 at 10:29 AM Martijn van Breden <
m.vanbreden@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hi Jay

From the documentation (
https://www.ibm.com/docs/en/i/7.5?topic=functions-http-post) it says that
the message should be the second parameter and options should be the third.
To me it looks as they have switched places in your call.

Kind regards,

Martijn van Breden
lead software architect

--

Pantheon Automatisering B.V.
T. 0513 657 357
M. 06 2075 2931

E-mail disclaimer


-----Oorspronkelijk bericht-----
Van: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> Namens Jay Vaughn
Verzonden: woensdag 23 november 2022 15:36
Aan: RPG programming on the IBM i (AS/400 and iSeries) <
rpg400-l@xxxxxxxxxxxxxxxxxx>
Onderwerp: qsys2.http_post

CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know
the content is safe.



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
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2022 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.