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

Re: [Ftpapi] httpapi example 3



Hi Mike,

It depends on the type of authentication they are requesting.  

The most common type of authentication is 'basic'.  If that is what is needed, you can do this prior to calling http_stmf:

http_setAuth( HTTP_AUTH_BASIC
            : 'your user id'
            : 'your password' );

If 'basic' isn't what it needs, you can make a request and let it fail with the 401, then call http_getAuth to find out what sort of authentication it was asking for.   Then, you can do http_setAuth to set the appropriate type of authentication and try again.

Good luck!

-SK

           

On 12/5/2019 11:08 AM, mike parker wrote:

Hi,

I have been trying to use the https example. I am getting error 401 Unauthorized.

I have created the certificate as per the instructions.

 How  do I add the userID and password?
 
-------
RPG Code:

app_id = 'AWTEC_HTTPAPI_SHAREPOINT';   

rc = https_init(app_id);               

if rc = -1;                            

   http_comp(http_error());            

   https_cleanup();                    

   return;                             

endif;                                 

http_stmf( 'GET'                                                           

         : 'https://xxxx.awtec.com/sites/IT/dev/Reports/Reports.docx'     

         : '/home/mparker/Reports.docx' );                                 

 
Error message: 

This page requires a user-id & password  


Error Log: 

recvdoc(): Receiving 16 bytes.                                        

401 UNAUTHORIZED                                                      

SetError() #36: This page requires a user-id & password               

http_close(): entered                                                  


HTTPAPI Ver 1.40 released 2019-08-15                                        

NTLM Ver 1.4.0 released 2014-12-22                                          

OS/400 Ver V7R2M0                                                           

 

New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0     

https_init(): entered                                                       

QSSLPCL = *OPSYS                                                            

SSL version 2 support disabled                                              

SSL version 3 support disabled                                              

Old interface to TLS version 1.0 support enabled                            

TLS version 1.0 support enabled                                             

TLS version 1.1 support enabled                                             

TLS version 1.2 support enabled                                              


Mike Parker
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi