<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Query Wikipedia API using PROC HTTP in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372714#M65176</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/50279"&gt;@Criptic&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try changing your syntax to remove the SET= part:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options SSLCALISTLOC="path_to_file/cacert-2017-06-07.pem";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your SAS session makes use of other SSL interactions, making this change could affect those other operations. &amp;nbsp;The list of certs and behavior depends on whether you are using SAS 9.4 m1 or m2, or m3/m4. &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=secref&amp;amp;docsetTarget=p0pul4j64w0mg0n1h1k6z8zhfvaf.htm&amp;amp;locale=en" target="_self"&gt;See the doc for this option.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is another option, &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=secref&amp;amp;docsetTarget=p0k2dumbsgs89fn1vew0vsd9cokh.htm&amp;amp;locale=en" target="_self"&gt;SSLCACERTDIR Environment Variable&lt;/A&gt;, that allows you to "inject" a cert path into your session. &amp;nbsp;See &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=secref&amp;amp;docsetTarget=p0k2dumbsgs89fn1vew0vsd9cokh.htm&amp;amp;locale=en" target="_self"&gt;that topic for a full description of the precendence list for SSL certs&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jul 2017 12:00:25 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2017-07-03T12:00:25Z</dc:date>
    <item>
      <title>Query Wikipedia API using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372051#M65160</link>
      <description>&lt;P&gt;Hey &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'm trying to query the Wikipedia-API and I get the following Error:&amp;nbsp;SSL Error: Missing CA trust list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried with adding perm file via the options (options set= SSLCALISTLOC="/path_to_file/cacert-2017-06-07.pem"; I got the pem-file from here:&amp;nbsp;&lt;A href="https://curl.haxx.se/docs/caextract.html" target="_blank"&gt;https://curl.haxx.se/docs/caextract.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code looks like this:&lt;/P&gt;
&lt;PRE&gt;options set= SSLCALISTLOC="path_to_file/cacert-2017-06-07.pem";
filename resp 'path_to_file/aaa.txt';

proc http
	url="https://en.wikipedia.org/w/api.php?action=query&amp;amp;titles=Main%20Page&amp;amp;prop=revisions&amp;amp;rvprop=content&amp;amp;format=json"
	out=resp
	method='GET'
	proxyhost="10.120.11.11"
	proxyport=8080;
run;&lt;/PRE&gt;
&lt;P&gt;If I'm using a HTTP site everything works like a charm, the error only occurs with https.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm currently on SAS 9.4 M2 - can somebody please give me pointers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 08:27:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372051#M65160</guid>
      <dc:creator>Criptic</dc:creator>
      <dc:date>2017-06-30T08:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Query Wikipedia API using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372134#M65161</link>
      <description>&lt;P&gt;Sounds like a cool project! I've been meaning to look into something similar with Wikipedia. &amp;nbsp;Thanks for the nudge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like you might not have everything quite right with the TLS requirements. &amp;nbsp;Can you try with a simple "echo" service from httpbin.org? That's a great way to test that your program "plumbing" is working before complicating things with the actual site you want data from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro echoResp(fn=);
    %global _respFilesize;
	data _null_;
		infile &amp;amp;fn;
		input;
		put _infile_;
	run;
%mend;

filename out temp;
filename input TEMP;
filename headout temp;

data _null_;
   file input;
   put "this is some sample text";
run;

proc http 
   url="https://httpbin.org/post"
   in=input
   out=out
   headerout=headout;
run;

%put Headers Out:;
%echoResp(fn=headout);

%put Response:;
%echoResp(fn=out);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Headers Out:
59         %echoResp(fn=headout);

NOTE: The infile HEADOUT is:
      Filename=#LN00106,
      RECFM=V,LRECL=32767,File Size (bytes)=302,
      Last Modified=30Jun2017:08:47:16,
      Create Time=30Jun2017:08:47:16

HTTP/1.1 200 OK
Connection: keep-alive
Server: meinheld/0.6.1
Date: Fri, 30 Jun 2017 12:47:17 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
X-Powered-By: Flask
X-Processed-Time: 0.00111889839172
Content-Length: 404
Via: 1.1 vegur
NOTE: 12 records were read from the infile HEADOUT.
      The minimum record length was 0.
      The maximum record length was 38.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

60         
61         %put Response:;
Response:
62         %echoResp(fn=out);

NOTE: The infile OUT is:
      Filename=#LN00104,
      RECFM=V,LRECL=32767,File Size (bytes)=404,
      Last Modified=30Jun2017:08:47:16,
      Create Time=30Jun2017:08:47:16

{
  "args": {}, 
  "data": "", 
  "files": {}, 
  "form": {
    "this is some sample text\r\n": ""
  }, 
  "headers": {
    "Accept": "*/*", 
    "Connection": "close", 
    "Content-Length": "26", 
    "Content-Type": "application/x-www-form-urlencoded", 
    "Host": "httpbin.org", 
    "User-Agent": "SAS/9"
  }, 
  "json": null, 
  "origin": "104.x.x.x", 
  "url": "https://httpbin.org/post"
}
NOTE: 19 records were read from the infile OUT.
      The minimum record length was 1.
      The maximum record length was 57.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 12:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372134#M65161</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-30T12:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Query Wikipedia API using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372652#M65174</link>
      <description>&lt;P&gt;Thank you for your reply. I tried your suggestions but I still get the same error:&amp;nbsp;SSL Error: Missing CA trust list. Do you have any further suggestions or ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 05:48:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372652#M65174</guid>
      <dc:creator>Criptic</dc:creator>
      <dc:date>2017-07-03T05:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Query Wikipedia API using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372714#M65176</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/50279"&gt;@Criptic&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try changing your syntax to remove the SET= part:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options SSLCALISTLOC="path_to_file/cacert-2017-06-07.pem";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your SAS session makes use of other SSL interactions, making this change could affect those other operations. &amp;nbsp;The list of certs and behavior depends on whether you are using SAS 9.4 m1 or m2, or m3/m4. &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=secref&amp;amp;docsetTarget=p0pul4j64w0mg0n1h1k6z8zhfvaf.htm&amp;amp;locale=en" target="_self"&gt;See the doc for this option.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is another option, &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=secref&amp;amp;docsetTarget=p0k2dumbsgs89fn1vew0vsd9cokh.htm&amp;amp;locale=en" target="_self"&gt;SSLCACERTDIR Environment Variable&lt;/A&gt;, that allows you to "inject" a cert path into your session. &amp;nbsp;See &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=secref&amp;amp;docsetTarget=p0k2dumbsgs89fn1vew0vsd9cokh.htm&amp;amp;locale=en" target="_self"&gt;that topic for a full description of the precendence list for SSL certs&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 12:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372714#M65176</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-07-03T12:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Query Wikipedia API using PROC HTTP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372715#M65177</link>
      <description>&lt;P&gt;&lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=secref&amp;amp;docsetTarget=p0pul4j64w0mg0n1h1k6z8zhfvaf.htm&amp;amp;locale=en" target="_self"&gt;This documentation&lt;/A&gt;&amp;nbsp;was exactly what I needed, thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 12:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Query-Wikipedia-API-using-PROC-HTTP/m-p/372715#M65177</guid>
      <dc:creator>Criptic</dc:creator>
      <dc:date>2017-07-03T12:30:43Z</dc:date>
    </item>
  </channel>
</rss>

