[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] Change HTTPAPI to respond to errors



John,

 

Not sure if this helps but I’ve been using a three strikes you’re out approach putting the HTTP call in a loop.  You could put a Sleep in there to try every time interval you choose.

 

clear HTTPAPICtr;     // Clear Bad HTTP API Call Ctr            

 Dow 1 = 1;                                                       

   rc = http_req( 'PUT'                                          

                : wrkURL                                         

                : *Omit                                          

                : HTTPResponse                                   

                : *Omit                                          

                : JSONInput                                   

                : 'application/json'  );                         

                                                                  

   // Good                                                       

   If rc >= 1                                                     

   And rc <= 399;                                                

     PutWebEnrlAcct#sErr = '0';                                  

     Leave;                                                      

   Else;                                                          

     // Bad                                                      

     PutWebEnrlAcct#sErr = '1';

      // Try HTTP API call three times then give up                            

      HTTPAPICtr = HTTPAPICtr + 1;                                             

      If HTTPAPICtr >= 3;  // 3 Strikes yer out!                               

         // more error stuff here but removed  

        http_debug(*OFF);    // turn back off

        Leave;                                                                 

      EndIf;                                                                   

      http_debug(*ON);    // turn on for errors       

    EndIf;                                                                     

  EndDo;                                                                                                           

 

From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx <ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx> On Behalf Of Baeten, John
Sent: Thursday, August 20, 2020 2:51 PM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: [Ftpapi] Change HTTPAPI to respond to errors

 

Our current process uses the HTTPAPI process to send data to a different system.  This is done in a RPGLE program using a RunCmd process to do the sending.  Sometimes there is a time out error (500) from the system we are sending to, and we currently do not have a way to monitor for that to give it a retry in a few minutes. 

 

wCMD =

HTTPAPI 

URL('https://websites.net/api/Pst')

DOWNLOAD(/LOG/CatalogSales_Log.txt')

REQTYPE(*POST)

UPLOAD('/Out/CATALOGPRODUCT.XML')

DEBUG('/log/CatalogSales_DBL.txt')

USER(4776-a7bf')

PASS(4776-a7bf')

 

ReturnCode = RunCmd(wCMD); 

 

After this process runs we are reading the log file to see if it was successful or not – but this only tells us that and not what the error was.  This would be in the DEBUG file.  We are hoping there is an easier way to determine the result of our POST.

 

Thanks,

 

John

 

 

John Baeten

Sr IT Developer – Pest Elimination – Commercial Solutions

T 651-795-6998 E john.baeten@xxxxxxxxxx

 

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may contain proprietary and privileged information for the use of the designated recipients named above. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.



CFNC

This email, including any documents, files, or previous email messages attached to it, has been sent from an email account of College Foundation Inc., (CFI) and may contain confidential, proprietary, or legally privileged information belonging to CFI. If you are not the intended recipient, any dissemination, distribution, or copying of this email or its attachments is strictly prohibited. If you have received this email in error, please immediately notify the sender by email and destroy the original email and any attachments.
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi