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

[Ftpapi] Adding security token to HTTPAPI



The vendor has confirmed their security setup is non-standard.

To add a custom header, I've added a call to http_xproc (code below).  Now, I'm getting the "301 Moved permanently" response.

My code is straightforward.  HTTPAPI works fine in my other applications.  The web service works (sorta) with cURL and Windows and an HTTPS URL.  However, my HTTPAPI version rejects HTTPS and I've reconfigured my target URL accordingly.

I will be grateful for a suggestion!

Thanks!

-mg

       http_debug(*ON:'/tmp/JSV100-log.txt');                                                  
       REST_WS_URL = %trimr(svv003_b('JSV100':'*AD4':'*URL'))              //Get URL               ​
       http_setCCSIDs(1208:0);                                             //Change char set       ​
       http_xproc(HTTP_Point_Addl_Header:%paddr(proc_AddHeader));          //Add special           ​`
       monitor;                                                                                    ​
          JSON_response = http_string('POST'                               //Send message            ​
                                     :REST_WS_URL                                                  ​
                                     :JSON_object                                                  ​
                                     :'application/JSON');                                         ​
       on-error;                                                                                   ​
          msg = http_error(http_status);                                                           ​
       endmon;                                                            
                                                                           ​
       Process_JSON(JSON_response);                                        ​//Process response
       return '';                                                          ​
                                                                           ​
       end-proc;                                                           ​
                                                                           ​
                                                                           ​
       dcl-proc proc_AddHeader;                                            ​//Add custom header
                                                                           ​
       dcl-pi *N;                                                          ​
          header varchar(32767);                                           ​
       end-pi;                                                             ​
                                                                           ​
       API_token = %trimr(svv003_b('JSV100':'*AD4':'*APITOKEN'));          ​//Get API key
                                                                           ​
       Header = 'X-API-Token:'                                             ​//Build header
                + API_token                                                ​
                + x'0D25';                                                 ​
                                                                           ​
       end-proc;                                                          
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi