I have been working with an API with sends out response in form of 10 ndjson files from 10 requests. Currently these all 10 files are saved separately but the requirement is to write the response in a single ndjson file. here is the http request and code. data _null_;
set jbst_rsp.output;
call execute('%download_srcfiles('||ordinal_output||','||type||','||url||')');
run;
%macro download_srcfiles(m_filenum,m_filetype,m_fileurl);
%let date_zz = %sysfunc(today());
%letsource_file%sysfunc(cats(%substr(&m_filetype,1,3),_,%sysfunc(putn(&date_zz,yymmddn6.)),_,%scan(&m_fileurl.,-1,'-')));
filename src_resp "/test/api/&m_filetype./&source_file.";
filename src_head "/%lowcase(&gmv_env.)/%lowcase(&gmv_client.)/source/api_responsefiles/fetch_file_head.txt";
proc http
url="&m_fileurl."
out=src_resp
method="GET"
headerout = src_head;
headers "Accept"="application/json"
"Authorization"="Bearer &access_token. ";
run;
%mend download_srcfiles; in jbst.output dataset i get list of 10 urls from files will be downloaded.using this list i am calling the download_srcfiles.
... View more