<?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: proc http; passing url parameters which have special characters in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489295#M72070</link>
    <description>&lt;P&gt;Great! Then try the test program I shared -- should reveal what you need.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Aug 2018 15:02:22 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2018-08-23T15:02:22Z</dc:date>
    <item>
      <title>proc http; passing url parameters which have special characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489133#M72060</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;am trying to&amp;nbsp;make a get request which had query parameter and the parameter value has special characters but when i pass it to proc http url parameter the special character are being missread and the value is not being supplied correctly to the service&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My url looks like this&lt;/P&gt;&lt;P&gt;http://myservice?name=abc+pqr&amp;amp;xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc http&lt;BR /&gt;url="&lt;SPAN&gt;http://myservice?name=abc+pqr&amp;amp;xyz&lt;/SPAN&gt;"&lt;BR /&gt;method=GET&lt;BR /&gt;ct="application/json"&lt;BR /&gt;in=input&lt;BR /&gt;out=resp&lt;BR /&gt;headerout=headout;&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the value is going as&amp;nbsp;&lt;SPAN&gt;abc pqr. I tried url encoding also but it dosent work for + and &amp;amp; symbols.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a way to encode urls when passing them to proc http&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 06:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489133#M72060</guid>
      <dc:creator>ravimlmath</dc:creator>
      <dc:date>2018-08-23T06:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc http; passing url parameters which have special characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489245#M72061</link>
      <description>&lt;P&gt;I think that your URL should work as-is with PROC HTTP.&amp;nbsp; Can you tell us what version of SAS you're using?&amp;nbsp; PROC HTTP has seen many improvements in SAS 9.4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The + symbol in a URL is translated to whitespace -- that's by design.&amp;nbsp; If you need the + as part of your data, encode it as %2B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try your test with the free service&amp;nbsp;&lt;STRONG&gt;httbin.org&lt;/STRONG&gt; and see if it echos back what you expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro echoResp(fn=);
data _null_;
 infile &amp;amp;fn;
 input;
 put _infile_;
run;
%mend;

filename resp temp;
proc http
 method='GET'
 url='https://httpbin.org/anything?name=abc+pqr&amp;amp;xyz'
 out=resp;
run;

%echoResp(fn=resp);
/*
 returns:
 "args": {
    "name": "abc pqr", 
    "xyz": ""
  }
*/

/* encoded plus symbol */
proc http
 method='GET'
 url='https://httpbin.org/anything?name=abc%2Bpqr&amp;amp;xyz'
 out=resp;
run;

%echoResp(fn=resp);
/*
  returns:
   "args": {
    "name": "abc+pqr", 
    "xyz": ""
  },
*/

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 13:05:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489245#M72061</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-08-23T13:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: proc http; passing url parameters which have special characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489291#M72069</link>
      <description>&lt;P&gt;I am using&amp;nbsp;SASv9.04.01M2P07232014&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 14:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489291#M72069</guid>
      <dc:creator>ravimlmath</dc:creator>
      <dc:date>2018-08-23T14:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc http; passing url parameters which have special characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489295#M72070</link>
      <description>&lt;P&gt;Great! Then try the test program I shared -- should reveal what you need.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 15:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489295#M72070</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-08-23T15:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc http; passing url parameters which have special characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489523#M72072</link>
      <description>&lt;P&gt;Thanks.. it works with encoded string..&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 08:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-http-passing-url-parameters-which-have-special-characters/m-p/489523#M72072</guid>
      <dc:creator>ravimlmath</dc:creator>
      <dc:date>2018-08-24T08:48:03Z</dc:date>
    </item>
  </channel>
</rss>

