<?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: How to use a working cURL command in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/727094#M226071</link>
    <description>&lt;P&gt;You must have been on to something. When I restarted SAS overnight, it just works now. I've spent 3 days trying as many combinations of quotes as I can think of, and today it just works (using the syntax in the original post).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hate it, lol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone for your help!&lt;/P&gt;</description>
    <pubDate>Wed, 17 Mar 2021 13:10:34 GMT</pubDate>
    <dc:creator>DevinChellberg</dc:creator>
    <dc:date>2021-03-17T13:10:34Z</dc:date>
    <item>
      <title>How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726529#M225756</link>
      <description>&lt;P&gt;I have a curl command that works in the command prompt that I need to get working in SAS 9.2. This is all translated from proc HTTP in 9.4 because some users at my company are still using the old version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The command that works in the command prompt (with abc123 substituted in critical positions):&amp;nbsp;&lt;/P&gt;&lt;P&gt;C:\Users\dc2\Downloads\curl.exe --location --request POST "&lt;A href="https://example.com" target="_blank" rel="noopener"&gt;https://example.com&lt;/A&gt;" -H&amp;nbsp;"Authorization:Basic&amp;nbsp;abc123==" -H&amp;nbsp;"Content-Type:application/x-www-form-urlencoded"&amp;nbsp;-H&amp;nbsp;"Cookie:abc123=abc123"&amp;nbsp;--data-urlencode&amp;nbsp;"grant_type=refresh_token"&amp;nbsp;--data-urlencode&amp;nbsp;"refresh_token=abc123" &amp;gt; "C:\token.json"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS it looks like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data test;
	
	CURLText = 'C:\Users\dc2\Downloads\curl.exe --location --request POST "https://example.com" -H&amp;nbsp;"Authorization:Basic&amp;nbsp;abc123==" -H&amp;nbsp;"Content-Type:application/x-www-form-urlencoded"&amp;nbsp;-H&amp;nbsp;"Cookie:abc123=abc123"&amp;nbsp;--data-urlencode&amp;nbsp;"grant_type=refresh_token"&amp;nbsp;--data-urlencode&amp;nbsp;"refresh_token=abc123" &amp;gt; "C:\token.json"';

	call symput ('CURLText', CURLText);
run;

filename req pipe %sysfunc(quote(&amp;amp;CURLText));

data _null_;
infile req missover lrecl= 32000;
input ;
file Response;
put _infile_;   
run;&lt;/PRE&gt;&lt;P&gt;Right now the error being stored in the local file is: Illegal character 'ﾠ' in header name. That error message goes away (and is replaced with an invalid request error) if I remove the colons from the header text.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any help getting this to work! Once I have it working in long form, I'll tackle storing some of the relevant bits in macro variables and referencing them within the filename statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 20:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726529#M225756</guid>
      <dc:creator>DevinChellberg</dc:creator>
      <dc:date>2021-03-15T20:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726613#M225801</link>
      <description>&lt;P&gt;How about this.&lt;/P&gt;
&lt;P&gt;Try adding two single quotes, one at the beginning and one at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CURLText = '''C:\Users\dc2\Downloads\curl.exe ..... =abc123" &amp;gt; "C:\token.json"''';
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Mar 2021 03:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726613#M225801</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-03-16T03:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726630#M225812</link>
      <description>&lt;P&gt;Use single quotes around the command:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symput ('CURLText',quote(CURLText,"'"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and no quoting in the FILENAME:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename req pipe CURLText;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 12:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726630#M225812</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-16T12:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726631#M225813</link>
      <description>&lt;P&gt;What happens if you quote in&lt;/P&gt;
&lt;PRE&gt;call symput ('CURLText', quote(trim(CURLText)));&lt;/PRE&gt;
&lt;P&gt;rather than in the filename?&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 06:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726631#M225813</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-16T06:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726707#M225851</link>
      <description>Did you try X command ?&lt;BR /&gt;&lt;BR /&gt;x 'C:\Users\dc2\Downloads\curl.exe --location --request POST "&lt;A href="https://example.com" target="_blank"&gt;https://example.com&lt;/A&gt;" -H "Authorization:Basic abc123==" -H "Content-Type:application/x-www-form-urlencoded" -H "Cookie:abc123=abc123" --data-urlencode "grant_type=refresh_token" --data-urlencode "refresh_token=abc123" &amp;gt; "C:\token.json"  ';&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Mar 2021 11:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726707#M225851</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-03-16T11:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726715#M225856</link>
      <description>That interpreted the outfile path as a single quote as part of the file type of the json (json'), returning an error of "The specified path is invalid" and not populating anything in the file.&lt;BR /&gt;&lt;BR /&gt;Thanks for the suggestion!</description>
      <pubDate>Tue, 16 Mar 2021 12:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726715#M225856</guid>
      <dc:creator>DevinChellberg</dc:creator>
      <dc:date>2021-03-16T12:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726716#M225857</link>
      <description>That returns the same error as my original code, "Illegal character ' ' in header name"&lt;BR /&gt;&lt;BR /&gt;Thanks for the suggestion!</description>
      <pubDate>Tue, 16 Mar 2021 12:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726716#M225857</guid>
      <dc:creator>DevinChellberg</dc:creator>
      <dc:date>2021-03-16T12:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726717#M225858</link>
      <description>No difference, unfortunately. Good idea to try it though!</description>
      <pubDate>Tue, 16 Mar 2021 12:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726717#M225858</guid>
      <dc:creator>DevinChellberg</dc:creator>
      <dc:date>2021-03-16T12:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726718#M225859</link>
      <description>I have experimented with filename, x, %sysexec, call system. I've had the most luck with filename in terms of even getting error messages back.&lt;BR /&gt;&lt;BR /&gt;When I run the above syntax with an x command, it doesn't appear to do anything at all: there is no output saved as the desired file location and the command prompt doesn't even flicker.&lt;BR /&gt;&lt;BR /&gt;If that feels like something easier to fix, I'd love to hear any suggestions!</description>
      <pubDate>Tue, 16 Mar 2021 12:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726718#M225859</guid>
      <dc:creator>DevinChellberg</dc:creator>
      <dc:date>2021-03-16T12:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726961#M225990</link>
      <description>&lt;P&gt;Can you show us the log please? I get a feeling that maybe the code is fine, and it's the returned data that trips SAS.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 02:11:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/726961#M225990</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-03-17T02:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a working cURL command in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/727094#M226071</link>
      <description>&lt;P&gt;You must have been on to something. When I restarted SAS overnight, it just works now. I've spent 3 days trying as many combinations of quotes as I can think of, and today it just works (using the syntax in the original post).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hate it, lol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 13:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-a-working-cURL-command-in-SAS/m-p/727094#M226071</guid>
      <dc:creator>DevinChellberg</dc:creator>
      <dc:date>2021-03-17T13:10:34Z</dc:date>
    </item>
  </channel>
</rss>

