<?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 convert a CURL command into PROC HTTP syntax in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726721#M225862</link>
    <description>&lt;P&gt;My mistake - the proper syntax is&amp;nbsp;&lt;STRONG&gt;webusername&lt;/STRONG&gt;=.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;filename resp temp;
proc http
 url="https://api.bcda.cms.gov/auth/token"
 webusername="3841c594-a8c0-41e5-98cc-38bb45360d3c:f9780d323588f1cdfc3e63e95a8cbdcdd47602ff48a537b51dc5d7834bf466416a716bd4508e904a"
 out=resp
 method="POST";
 debug level=2;
headers "Accept"="application/json";
run;

libname auth JSON fileref=resp;
data _null_;
 rc=jsonpp('resp','log');
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;According to the API doc they don't want a separate password -- it's all part of the user= value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The TLS error might be something else though. Make sure you can use PROC HTTP with SSL (certificates need to be in place). &lt;A href="https://blogs.sas.com/content/sasdummy/2018/01/23/check-json-and-http/" target="_self"&gt;Here's how to test&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Mar 2021 12:30:14 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2021-03-16T12:30:14Z</dc:date>
    <item>
      <title>How to convert a CURL command into PROC HTTP syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726381#M225695</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can someone please help me convert the following (working) cURL command into the PROC HTTP equivalent?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;curl -d '' -X POST 'https://api.bcda.cms.gov/auth/token' \
	--user 3841c594-a8c0-41e5-98cc-38bb45360d3c:f9780d323588f1cdfc3e63e95a8cbdcdd47602ff48a537b51dc5d7834bf466416a716bd4508e904a \
	-H "accept: application/json"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The parameters under --user are clientid:client secret key&lt;/P&gt;
&lt;P&gt;The response which is expected for this request is :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE tabindex="0"&gt;{
"access_token": "eyJhbGciOiJSUzUxMiIsInR5c...",
"token_type":"bearer"
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is appreciated.&lt;/P&gt;
&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 14:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726381#M225695</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2021-03-15T14:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a CURL command into PROC HTTP syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726424#M225707</link>
      <description>&lt;P&gt;See this blog post: &lt;A href="https://blogs.sas.com/content/sgf/2020/07/30/curl-to-proc-http/" target="_self"&gt;How to translate your cURL command to PROC HTTP&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you might end up with something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;filename resp temp;
proc http
 url="https://api.bcda.cms.gov/auth/token"
 webuserid="3841c594-a8c0-41e5-98cc-38bb45360d3c:f9780d323588f1cdfc3e63e95a8cbdcdd47602ff48a537b51dc5d7834bf466416a716bd4508e904a"
 out=resp
 method="POST";
headers "Accept"="application/json";
run;

libname auth JSON fileref=resp;
/* use DATA step to get data from AUTH, the JSON response */&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 Mar 2021 15:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726424#M225707</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-03-15T15:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a CURL command into PROC HTTP syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726624#M225807</link>
      <description>&lt;P&gt;I tried using the above code, gave me syntax error as below,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;27         proc http
28          url="https://api.bcda.cms.gov/auth/token"
29          webuserid="c0a02574-6432-4e65-b8da-cb6f264b4544:c04473622271dd3ffa53ab0c85ed006fa6c0fb59b6d8e3409bd411e396599f7451cd53ae
            _________
            22
            76
29       ! f1b370a4"
ERROR 22-322: Syntax error, expecting one of the following: ;, AUTH_ANY, AUTH_BASIC, AUTH_NEGOTIATE, AUTH_NONE, AUTH_NTLM, 
              CLEAR_CACHE, CLEAR_CONN_CACHE, CLEAR_COOKIES, CT, EXPECT_100_CONTINUE, FOLLOWLOC, HEADERIN, HEADEROUT, 
              HEADEROUT_OVERWRITE, HTTP_TOKENAUTH, IN, METHOD, NOFOLLOW, NOFOLLOWLOC, NO_CONN_CACHE, NO_COOKIES, OUT, PROXYHOST, 
              PROXYPASSWORD, PROXYPORT, PROXYUSERNAME, PROXY_AUTH_BASIC, PROXY_AUTH_NEGOTIATE, PROXY_AUTH_NONE, PROXY_AUTH_NTLM, 
              URL, VERBOSE, WEBAUTHDOMAIN, WEBPASSWORD, WEBUSERNAME.  
ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then i changed the webuserid to webusername and webpassword, Got the below error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;26         filename resp temp;
27         proc http
28          url="https://api.bcda.cms.gov/auth/token"
29          webusername="c0a02574-6432-4e65-b8da-cb6f264b4544"
30         	WEBPASSWORD = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
31          out=resp
32          method="POST";
33         headers "Accept"="application/json";
34         run;

ERROR: OpenSSL error 336032824 (0x14077438) occurred in SSL_connect/accept at line 5388, the error message is "error:14077438:SSL 
       routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error".
ERROR: Secure communications error status 807ff008 description "OpenSSL error 336032824 (0x14077438) occurred in SSL_connect/accept 
       at line 5388, the error message is "error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error"."
ERROR: Encryption run-time execution error
ERROR: Call to tcpSockContinueSSL failed.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Don't have much idea about such error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 05:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726624#M225807</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2021-03-16T05:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a CURL command into PROC HTTP syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726721#M225862</link>
      <description>&lt;P&gt;My mistake - the proper syntax is&amp;nbsp;&lt;STRONG&gt;webusername&lt;/STRONG&gt;=.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;filename resp temp;
proc http
 url="https://api.bcda.cms.gov/auth/token"
 webusername="3841c594-a8c0-41e5-98cc-38bb45360d3c:f9780d323588f1cdfc3e63e95a8cbdcdd47602ff48a537b51dc5d7834bf466416a716bd4508e904a"
 out=resp
 method="POST";
 debug level=2;
headers "Accept"="application/json";
run;

libname auth JSON fileref=resp;
data _null_;
 rc=jsonpp('resp','log');
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;According to the API doc they don't want a separate password -- it's all part of the user= value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The TLS error might be something else though. Make sure you can use PROC HTTP with SSL (certificates need to be in place). &lt;A href="https://blogs.sas.com/content/sasdummy/2018/01/23/check-json-and-http/" target="_self"&gt;Here's how to test&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 12:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/726721#M225862</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-03-16T12:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a CURL command into PROC HTTP syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/731816#M227997</link>
      <description>Well we tried the test, it ran through successfully.&lt;BR /&gt;however, when we ran the above code, this gave us "Access denied" as the api response and 403 Forbidden as the status code.&lt;BR /&gt;Just some additional info, we do have the access for the URL's  and right credentials, as we were able to submit successful requests using postman and python.&lt;BR /&gt;Any suggestions on if we are missing something while sending the credentials to get a token using above code.&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 07 Apr 2021 06:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/731816#M227997</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2021-04-07T06:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a CURL command into PROC HTTP syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/731881#M228021</link>
      <description>&lt;P&gt;I think in cURL the --user option has the form "user:password" where the colon separates the user ID from the password. Would you try something like this?&amp;nbsp; Also, the -d option sets the content-type to&amp;nbsp;application/x-www-form-urlencoded. You're not sending any content but I figured I'd set the content type in this call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;filename resp temp;
proc http
 url="https://api.bcda.cms.gov/auth/token"
 webusername="3841c594-a8c0-41e5-98cc-38bb45360d3c"
 webpassword="f9780d323588f1cdfc3e63e95a8cbdcdd47602ff48a537b51dc5d7834bf466416a716bd4508e904a"
 out=resp
 ct="application/x-www-form-urlencoded"
 method="POST";
 debug level=2;
headers "Accept"="application/json";
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 12:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/731881#M228021</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-04-07T12:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a CURL command into PROC HTTP syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/733211#M228493</link>
      <description>We added options like :set=SSL_USE_SNI="1" set=SSL_SNI_HOSTNAME="URL"; to resolve the SSL issue we had.&lt;BR /&gt;The above code worked to get the response from the URL.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 13 Apr 2021 05:41:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-a-CURL-command-into-PROC-HTTP-syntax/m-p/733211#M228493</guid>
      <dc:creator>Anmolkhandelwal</dc:creator>
      <dc:date>2021-04-13T05:41:12Z</dc:date>
    </item>
  </channel>
</rss>

