×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Paul,

Those look like Apache directives. The OP was requesting about HTTPAPI and
client connections, not server connections. Just an FYI. I know these get
confusing sometimes. :)


Bradley V. Stone
www.bvstools.com
Need to interface with Braintree with your IBM i? Contact me
<https://www.bvstools.com/contact.html> for more information!

On Thu, Sep 20, 2018 at 8:52 AM Steinmetz, Paul <PSteinmetz@xxxxxxxxxx>
wrote:

We have a similar setup, and also changed to using a persistent
connection, for both eliminating timeouts and performance issues.
Below were the HTTP directives that were needed for persistent connection.

KeepAliveTimeout 86400
MaxKeepAliveRequests 0

Paul



-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Greg
Wilburn
Sent: Thursday, September 20, 2018 9:07 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: http-api how to properly hit a api end point multiple times.
((from midrange-l)

I have at least 3 different interfaces to applications that require a
single request per item... good luck getting an established commercial web
application to change their APIs. They were likely not designed for a
"batch" style update.

Mine work using the http_persist_ group of procedures... it's just
relatively slow.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Charles Wilt
Sent: Wednesday, September 19, 2018 6:38 PM
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Subject: Re: http-api how to properly hit a api end point multiple times.
((from midrange-l)

As Brad mentions, using a persistent connection would be the most
efficient as you're not opening/closing the HTTP connection for each
request.

But you're still going to have to call http_persist_post() 1000 times in a
loop.
http_persist_open();
for x = 1 to 1000;
http_persist_post();
endfor;
http_persist_close();

A truly "better" way would require that the server you're posting to
support a better way...ie some way to send a request for all 1000 articles
at one time.

The only other improvement you can make from your side alone would be to
multi-thread the requests. That should allow your process to complete much
faster. Assuming you don't overload the server on the other side.

Charles



On Wed, Sep 19, 2018 at 9:06 AM Gerald Magnuson <
gmagqcy.midrange@xxxxxxxxx>
wrote:

I am trying to optimize this

I have a http api that I need to hit repetitively :

// If Procs is 0, then set debug, set auth
if Procs = 0 ;
http_debug(*ON:'/tmp/gem_GLOC2_debug.txt');
http_setauth(HTTP_AUTH_BASIC: userid: pass) ;
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(add_headers) ); endif ; if Procs = -1;
*inLR = *on ;
return ;
endif ;

msgdata = '{"articles":[{"typeid":1,"articleSecondaryId":+
'+ap2+%trim(itemnbr)+ap2+'}]} ' ;
msgdataL = %len(%trim(msgdata));
rc=http_url_post_raw(
'https://mchporl.xxx.com/LTSystem/+
api/v2/article/search'
:%addr(msgdata)
: msgdataL
:1
: %paddr('INCOMING')
:HTTP_TIMEOUT
:HTTP_USERAGENT
: 'application/json' );

return retdata ;


I would presume that there is a better way for me to iterate a list of
item numbers than loading my msgdata field and then calling the
http_url_post_raw 1000 times...
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

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

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

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

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

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