<?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: Requesting Guidance on making a PROC HTTP call by passing bearer token in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476306#M71216</link>
    <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sasdummy/2018/01/23/check-json-and-http/" target="_self"&gt;See a simple PROC HTTP test program here&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Sun, 08 Jul 2018 19:39:45 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2018-07-08T19:39:45Z</dc:date>
    <item>
      <title>Requesting Guidance on making a PROC HTTP call by passing bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476291#M71212</link>
      <description>&lt;P&gt;All,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;I am new to SAS and have been trying to learn and appreciate the help of anyone who can guide me on this issue. I have an internal API which I have successfully accessed using R, I am trying to now learn how to the same using PROC HTTP. My R code that works successfully is provided below, I am also attaching my attempt of the SAS code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;RawResponse1 &amp;lt;- GET(RequestURL1, add_headers('Authorization' = paste0('Bearer ', AccessToken)))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; In the above code, RequestURL1 and AccessToken are custom built. My attempt and rebuilding this in SAS is shown below:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;       filename ProjResp "/ProjApiResponse.txt"; * edited the filepath ;

	Proc HTTP
	    URL = URLDes
            Method ="get" 
            Out = ProjResp 
            ct = "Authorization" = "Bearer &amp;amp;AccessToken"; 
	Run;

        * URLDes is the custom URL equivalent to RequestURL1 in the previous case ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jul 2018 15:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476291#M71212</guid>
      <dc:creator>UdayGuntupalli</dc:creator>
      <dc:date>2018-07-08T15:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Requesting Guidance on making a PROC HTTP call by passing bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476302#M71213</link>
      <description>&lt;P&gt;You want the HEADERS statement in PROC HTTP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sasdummy/2017/04/14/using-sas-to-access-google-analytics-apis/" target="_self"&gt;I have a complex example here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code would look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	Proc HTTP
	    URL = URLDes
            Method ="get" 
            Out = ProjResp ;
            headers "Authorization" = "Bearer &amp;amp;AccessToken"; 
	Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 08 Jul 2018 19:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476302#M71213</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-07-08T19:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Requesting Guidance on making a PROC HTTP call by passing bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476304#M71214</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Thanks a lot for your response. I edited the code per your suggestion, please see below :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc HTTP
        URL = URLDes
        Method ="get" 
        Out = ProjResp ;
        headers "Authorization" = "Bearer &amp;amp;AccessToken"; 
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I receive the following errors and I don't understand what the errors mean. Could you kindly offer any further guidance ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21642iB95C5743992D80D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jul 2018 19:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476304#M71214</guid>
      <dc:creator>UdayGuntupalli</dc:creator>
      <dc:date>2018-07-08T19:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Requesting Guidance on making a PROC HTTP call by passing bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476305#M71215</link>
      <description>&lt;P&gt;What's the value of URLDes?&amp;nbsp; This should be a &lt;STRONG&gt;quoted&lt;/STRONG&gt; string with with URL of the web service you're calling.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I assume you have a macro variable with that's assigned with the value of you access token, eg:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let AccessToken=123454678992ehgue;&lt;/PRE&gt;</description>
      <pubDate>Sun, 08 Jul 2018 19:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476305#M71215</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-07-08T19:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Requesting Guidance on making a PROC HTTP call by passing bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476306#M71216</link>
      <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sasdummy/2018/01/23/check-json-and-http/" target="_self"&gt;See a simple PROC HTTP test program here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jul 2018 19:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476306#M71216</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-07-08T19:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Requesting Guidance on making a PROC HTTP call by passing bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476310#M71217</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data _null_; 
		URLDes = &amp;amp;URLToUse || "/" || &amp;amp;ProjectID || "/" || "Prediction" || "/" || &amp;amp;PredictionID; 
		put URLDes; 
		Test = vtype(URLDes); 
		put Test= ;
		%put &amp;amp;AccessToken;
Run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;From the steps shown above, URLDes is a valid&amp;nbsp; hyperlink, it is saved as a character. So, wondering what the issue is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;!--    SECTION 1    --&gt;&lt;!--    [if gte IE 9]&amp;amp;amp;gt;
        &amp;amp;amp;lt;link media=&amp;amp;amp;quot;screen&amp;amp;amp;quot; rel=&amp;amp;amp;quot;stylesheet&amp;amp;amp;quot; href=&amp;amp;amp;quot;proxy/307000.1.0.20170823190000_d4dms37/resources/js/dojo/dijit/themes/corporate/css/webdms_ie.css&amp;amp;amp;quot; /&amp;amp;amp;gt;
&amp;amp;amp;lt;![endif]   --&gt;&lt;!--    [if lte IE 9]&amp;amp;amp;gt;
    &amp;amp;amp;amp;lt;script type=&amp;amp;amp;quot;text/javascript&amp;amp;amp;quot;&amp;amp;amp;gt;
    var splashUpdateInterval;
	(function(){
		var count=0;
		splashUpdateInterval = setInterval(function(){
	    count++;
	    var elm=document.getElementById('sas-hc-splash-headerText')
	    if(elm){
	        elm.innerHTML = &amp;amp;amp;quot;Initializing&amp;amp;amp;quot; + new Array(count % 5).join('.');
	    }else{
	        window.clearInterval(splashUpdateInterval);
	    }
	}, 300);
	}())
    &amp;amp;amp;amp;lt;/script&amp;amp;amp;amp;gt;
&amp;amp;amp;lt;![endif]   --&gt;&lt;!--    This is for the process flow control (used in query)    --&gt;&lt;!--    fav and touch icons    --&gt;&lt;!--        &amp;amp;amp;lt;link rel=&amp;amp;amp;quot;shortcut icon&amp;amp;amp;quot; href=&amp;amp;amp;quot;assets/ico/favicon.ico&amp;amp;amp;quot;&amp;amp;amp;gt;
    &amp;amp;amp;lt;link rel=&amp;amp;amp;quot;apple-touch-icon&amp;amp;amp;quot; href=&amp;amp;amp;quot;assets/ico/apple-touch-icon.png&amp;amp;amp;quot;&amp;amp;amp;gt;
    &amp;amp;amp;lt;link rel=&amp;amp;amp;quot;apple-touch-icon&amp;amp;amp;quot; sizes=&amp;amp;amp;quot;72x72&amp;amp;amp;quot; href=&amp;amp;amp;quot;assets/ico/apple-touch-icon-72x72.png&amp;amp;amp;quot;&amp;amp;amp;gt;
    &amp;amp;amp;lt;link rel=&amp;amp;amp;quot;apple-touch-icon&amp;amp;amp;quot; sizes=&amp;amp;amp;quot;114x114&amp;amp;amp;quot; href=&amp;amp;amp;quot;assets/ico/apple-touch-icon-114x114.png&amp;amp;amp;quot;&amp;amp;amp;gt;

    --&gt;&lt;!--    Standard iPhone    --&gt;&lt;!--    Retina iPhone    --&gt;&lt;!--    Standard iPad    --&gt;&lt;!--    Retina iPad    --&gt;&lt;!--    data-dojo-type = &amp;amp;amp;quot;&amp;amp;amp;quot;    --&gt;&lt;/P&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter dijitContentPaneSingleChild"&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitAlignCenter dijitContentPaneSingleChild dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane"&gt;&lt;DIV class="tabs dijitBorderContainer dijitContainer dojoDndTarget sasStudioTabsParentContainer dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasStudioTabsTabContainer sasStudioTabsTabContainerVertical sasStudioTabsTop dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer sasStudioTabsTabContainerChild dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dojoDndTarget dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasSuiteTabs dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;tI1p-YLmpMDkNfHs6e1NASTCNqzBxitqruK1KqEezOckgUDDX8An_AT8iEKgt9qpXuhNlvpJWOMshvVJm7ZqC3_pneDRZkXisEvHvytYmwWMAOqduAC6fdP6zUZlfETlxNib&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;zUabPhtGRie-c7RW1WAkg3lOviPDyUZQ31UjC9ES6vgojzjHmV6I75ngIdUtD22W6EGoR9enXPdW6H-BCzT-DqDZKBsQULrHauwm08IGP__tVwmzP85cEDf96h_eTS1jK4d1&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Ydy67TT5T3FOADP31h5oCUIRZtUkytwL3lT_JxFPRN_tJpwXxa_xhwqJRisMaA&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&lt;A href="https://api.plantpredict.com/Project/4557/Prediction/21404" target="_blank"&gt;https://api.plantpredict.com/Project/1234/Prediction/&lt;/A&gt;45667&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;Test=C&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 08 Jul 2018 19:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476310#M71217</guid>
      <dc:creator>UdayGuntupalli</dc:creator>
      <dc:date>2018-07-08T19:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Requesting Guidance on making a PROC HTTP call by passing bearer token</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476400#M71219</link>
      <description>&lt;P&gt;And then did you SYMPUT the value into a macro variable?&amp;nbsp; Your computed name in the DATA step won't be in scope by the time you get to the PROC HTTP step -- you have to store it in a macro variable.&amp;nbsp; Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data _null_; 
 URLDes = &amp;amp;URLToUse || "/" || &amp;amp;ProjectID || "/" || "Prediction" || "/" || &amp;amp;PredictionID;
 call symputx('URLDes',URLDes); 
;
Run; 
proc http
 method="GET"
 url = "&amp;amp;URLDes."
 out=ProjResp;
 headers
   "Authorization"="Bearer &amp;amp;AccessToken.";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jul 2018 11:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Requesting-Guidance-on-making-a-PROC-HTTP-call-by-passing-bearer/m-p/476400#M71219</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-07-09T11:36:49Z</dc:date>
    </item>
  </channel>
</rss>

