<?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: Make a list of reports and their folders in SAS Viya through REST API calls in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Make-a-list-of-reports-and-their-folders-in-SAS-Viya-through/m-p/647451#M804</link>
    <description>&lt;P&gt;Have a look here &lt;A href="https://developer.sas.com/apis/rest/CoreServices/#get-a-resource-39-s-ancestors" target="_blank"&gt;https://developer.sas.com/apis/rest/CoreServices/#get-a-resource-39-s-ancestors&lt;/A&gt;&amp;nbsp;to get the folder information of a report&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS sample code looks like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc http
  url="&amp;amp;BASE_URI/folders/ancestors?childUri=/reports/reports/72c7e418-cd68-49c7-8f2f-6e9548639821"
  method='GET' 
  oauth_bearer=sas_services
  out=resp
  ;
run;

%put NOTE: resp json pretty print;

%put %sysfunc( jsonpp(resp, log));
libname resp json fileref=resp;
proc copy in=resp out=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 May 2020 12:58:05 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2020-05-13T12:58:05Z</dc:date>
    <item>
      <title>Make a list of reports and their folders in SAS Viya through REST API calls</title>
      <link>https://communities.sas.com/t5/Developers/Make-a-list-of-reports-and-their-folders-in-SAS-Viya-through/m-p/647202#M800</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I am looking for a way of creating a&amp;nbsp;list of SAS reports and their parent locations. I guess the way to go is to search for the&amp;nbsp;folders where the reports are by using REST API calls,&amp;nbsp;but I could not find a way of developing a SAS job for it.&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have a list of my Viya reports (&lt;A href="http://sasviya35.example.local/reports/reports" target="_blank" rel="noopener"&gt;http://sasviya35.example.local/reports/reports&lt;/A&gt;) in .json format. Through a Rest API call using PROC HTTP, i.e.:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;filename jsonout temp;&lt;BR /&gt;proc http&lt;BR /&gt;&amp;nbsp; url=" &lt;A href="http://sasviya35.example.local/reports/reports" target="_blank" rel="noopener"&gt;http://sasviya35.example.local/reports/reports&lt;/A&gt; "&lt;BR /&gt;&amp;nbsp; method="get"&lt;BR /&gt;&amp;nbsp; oauth_bearer=sas_services&lt;BR /&gt;&amp;nbsp; out=jsonout;&lt;BR /&gt;run;&lt;BR /&gt;libname reports json fileref=jsonout;&lt;BR /&gt;proc print data=reports.items;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;it is possible to output some information (id, name, created by, creation time, etc.), but I do not know how to search for the reports' folder paths.&lt;BR /&gt;&lt;BR /&gt;There are command-line tools that call the SAS Viya REST APIs, but what I have seen so far is based in other programming languages (e.g.&amp;nbsp;&lt;A href="https://developer.sas.com/apis/rest/" target="_blank" rel="noopener"&gt;https://developer.sas.com/apis/rest/&lt;/A&gt;&amp;nbsp;and &lt;A href="https://github.com/sassoftware/pyviyatools" target="_blank" rel="noopener"&gt;https://github.com/sassoftware/pyviyatools&lt;/A&gt;) and it is not clear how to map those codes into a SAS program.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As an output, I would like to have something as the following example:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE border="1" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Report&lt;/TD&gt;&lt;TD&gt;Folder&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Report1&lt;/TD&gt;&lt;TD&gt;/User/Project/Reports&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Report2&lt;/TD&gt;&lt;TD&gt;/User/Project/Reports&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Report3&lt;/TD&gt;&lt;TD&gt;/User/MyFolder/Test&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Report4&lt;/TD&gt;&lt;TD&gt;/Apps/SAS/Data&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Please, let me know if something is unclear and I will try to better explain.&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Thanks,&lt;DIV&gt;Jorge&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 12 May 2020 18:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Make-a-list-of-reports-and-their-folders-in-SAS-Viya-through/m-p/647202#M800</guid>
      <dc:creator>jnogueira</dc:creator>
      <dc:date>2020-05-12T18:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Make a list of reports and their folders in SAS Viya through REST API calls</title>
      <link>https://communities.sas.com/t5/Developers/Make-a-list-of-reports-and-their-folders-in-SAS-Viya-through/m-p/647451#M804</link>
      <description>&lt;P&gt;Have a look here &lt;A href="https://developer.sas.com/apis/rest/CoreServices/#get-a-resource-39-s-ancestors" target="_blank"&gt;https://developer.sas.com/apis/rest/CoreServices/#get-a-resource-39-s-ancestors&lt;/A&gt;&amp;nbsp;to get the folder information of a report&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS sample code looks like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc http
  url="&amp;amp;BASE_URI/folders/ancestors?childUri=/reports/reports/72c7e418-cd68-49c7-8f2f-6e9548639821"
  method='GET' 
  oauth_bearer=sas_services
  out=resp
  ;
run;

%put NOTE: resp json pretty print;

%put %sysfunc( jsonpp(resp, log));
libname resp json fileref=resp;
proc copy in=resp out=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 May 2020 12:58:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Make-a-list-of-reports-and-their-folders-in-SAS-Viya-through/m-p/647451#M804</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2020-05-13T12:58:05Z</dc:date>
    </item>
  </channel>
</rss>

