<?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: Need help translating from curl to proc http in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-help-translating-from-curl-to-proc-http/m-p/696100#M212547</link>
    <description>&lt;P&gt;Does the query work with only one grant type?&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/124306"&gt;@JosephHenry&lt;/a&gt;&amp;nbsp;Would you mind looking?&lt;/P&gt;</description>
    <pubDate>Tue, 03 Nov 2020 05:49:26 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-11-03T05:49:26Z</dc:date>
    <item>
      <title>Need help translating from curl to proc http</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-translating-from-curl-to-proc-http/m-p/695865#M212417</link>
      <description>&lt;P&gt;I am trying to follow this tutorial using proc http:&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sgf/2019/01/25/authentication-to-sas-viya/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2019/01/25/authentication-to-sas-viya/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But I am struggling with this part:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;curl -k -X POST "https://sasserver.demo.sas.com/SASLogon/oauth/clients" \
       -H "Content-Type: application/json" \
       -H "Authorization: Bearer $IDTOKEN" \
       -d '{
        "client_id": "myclientid", 
        "client_secret": "myclientsecret",
        "scope": ["openid", "group1"],
        "authorized_grant_types": ["authorization_code","refresh_token"],
        "redirect_uri": "urn:ietf:wg:oauth:2.0:oob"
       }'&lt;/PRE&gt;&lt;P&gt;Specifically, I cant find the correct syntax for having two values in a square bracket. I am trying the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc http url="&amp;amp;baseurl/SASLogon/oauth/clients" 
method="POST" 
auth_basic
headerout=hdrs
headerout_overwrite
in= FORM (	"client_id"="&amp;amp;app" 
			"client_secret"="&amp;amp;clientsecret"
			"scope="="['openid', 'SASapp_Admin_GUEST']"
			"authorized_grant_types"= "['authorization_code', 'refresh_token']"
        	"access_token_validity"= "350000000"
        	"redirect_uri"= "urn:ietf:wg:oauth:2.0:oob"
		
)
out=out;
headers "Content-Type"="application/json"
"Authorization"="Bearer &amp;amp;access_token"
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I get&amp;nbsp; a bad request. How do I handle multiple values for scope and grant types?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 09:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-translating-from-curl-to-proc-http/m-p/695865#M212417</guid>
      <dc:creator>Ullsokk</dc:creator>
      <dc:date>2020-11-02T09:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need help translating from curl to proc http</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-translating-from-curl-to-proc-http/m-p/696100#M212547</link>
      <description>&lt;P&gt;Does the query work with only one grant type?&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/124306"&gt;@JosephHenry&lt;/a&gt;&amp;nbsp;Would you mind looking?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2020 05:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-translating-from-curl-to-proc-http/m-p/696100#M212547</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-11-03T05:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Need help translating from curl to proc http</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-translating-from-curl-to-proc-http/m-p/696213#M212623</link>
      <description>&lt;P&gt;Ok you have a few problems here. The first and biggest one is that you are sending a Form, when the input is expected to be JSON.&lt;/P&gt;
&lt;P&gt;You can format the JSON using a datastep, or you could simply type it in like I show below, just make sure to escape quotes with a quote.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second is that you have auth_basic listed, when you are using oauth. you should use the OAUTH_BEARER option to send in the token.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the example code, I think it should work for you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc http url="httpbin.org/post" 
  method="POST" 
  headerout=hdrs
  headerout_overwrite
  in= "{""client_id"":""&amp;amp;app"",
 ""client_secret"":""&amp;amp;clientsecret"",
 ""scope="":[""openid"", ""SASapp_Admin_GUEST""],
 ""authorized_grant_types"": [""authorization_code"", ""refresh_token""],
 ""access_token_validity"": 350000000,
 ""redirect_uri"": ""urn:ietf:wg:oauth:2.0:oob""}"
  out=out
  OAUTH_BEARER="&amp;amp;access_token";
  headers "Content-Type"="application/json"
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Nov 2020 14:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-translating-from-curl-to-proc-http/m-p/696213#M212623</guid>
      <dc:creator>JosephHenry</dc:creator>
      <dc:date>2020-11-03T14:49:32Z</dc:date>
    </item>
  </channel>
</rss>

