| 
 Hi All, I am calling a web service that requires several steps. Each step returns a string in the header that is used in the URL for the next step.   It works the first time I run it, but fails on subsequent calls. By fail, I mean it doesn’t return
 a 303 return code.     If I wait a while (several hours or next day) and call again, it will work on the first call.  It runs in Postman every time.  Is there a cache I need to clear between calls?   
 I have attached log files for both scenarios.   Logfile1 shows when it works properly.   Logfile2 shows a subsequent call.  Thank you for looking at this.       
// Set credentials        http_setauth(HTTP_AUTH_BEARER:
 username: passwd);       
// Set first URL        URL
= 
'https://api.adp.com/hr/v2/workers';       
// tell it we want async processing and get response.........       
callp http_xproc(HTTP_POINT_ADDL_HEADER:%PADDR(AdditionalHeaders));        rc
= http_req('GET':
 URL:
*omit: response)
;   
ç=========This works every time……………       
If rc
=
202
;          response
= http_header('link')
;                  
       
Else
;           http_comp(http_error());          
exsr $Exit
;       
EndIf;       
// now substring out the part of the response header that we want        pos1
=
%scan('<':
 response)
;        pos1
+=
1
;        pos2
=
%scan('>':
 response)
;        link
=
%subst(response:
 Pos1:  Pos2
- pos1)
;        URL
= 
'https://api.adp.com'
+
%trim(link)
;       
// use the link to get the URL for the location of the asyncronous server        rc
= http_req('GET':
 URL:
*omit: response) 
;   
ç=========This call returns 303 the first
 time as expected       
If rc
=
303
;                                        
In subsequent calls rc = 1 and no value in response header          response
= http_header('location')
;       
Else
;           http_comp(http_error());          
exsr $Exit
;       
EndIf;      
// now use that part of the URL to make the fetch        URL
= 
'https://api.adp.com'
+
%trim(response)
;      
// get the data to a file on IFS       filename
=
'/docs/temp/adp0003.txt'
;      rc
= http_url_get(
 url : filename
);     
if
(rc
<>
1);        
exsr $exit
;     
endif;                                                                                  
 
  | 
Attachment:
httpapi_logfile1.log
Description: httpapi_logfile1.log
Attachment:
httpapi_logfile2.log
Description: httpapi_logfile2.log
-- _______________________________________________ Ftpapi mailing list Ftpapi@xxxxxxxxxxxxxxxxxxxxxx http://scottklement.com/mailman/listinfo/ftpapi