<?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 Create a report/table relationship report? in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/616191#M613</link>
    <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a report listing all reports created in VA 8.3 and the related CAS data tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am assuming I need to use the RESI API for this, specifically the relationships call.&amp;nbsp;&lt;A href="https://developer.sas.com/apis/rest/CoreServices/#relationships" target="_blank"&gt;https://developer.sas.com/apis/rest/CoreServices/#relationships&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However before I begin, perhaps I am missing a more obvious way to create such a report. Has anyone created such a report?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kind regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jan 2020 13:58:30 GMT</pubDate>
    <dc:creator>RichardP</dc:creator>
    <dc:date>2020-01-09T13:58:30Z</dc:date>
    <item>
      <title>Create a report/table relationship report?</title>
      <link>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/616191#M613</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a report listing all reports created in VA 8.3 and the related CAS data tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am assuming I need to use the RESI API for this, specifically the relationships call.&amp;nbsp;&lt;A href="https://developer.sas.com/apis/rest/CoreServices/#relationships" target="_blank"&gt;https://developer.sas.com/apis/rest/CoreServices/#relationships&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However before I begin, perhaps I am missing a more obvious way to create such a report. Has anyone created such a report?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kind regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 13:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/616191#M613</guid>
      <dc:creator>RichardP</dc:creator>
      <dc:date>2020-01-09T13:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create a report/table relationship report?</title>
      <link>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/616365#M616</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274763"&gt;@RichardP&lt;/a&gt;, I'm setting up an env to test this out and talk to a couple of colleagues to see if there is a recommendation for this. I'll get back to you as soon as I complete the analysis.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 01:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/616365#M616</guid>
      <dc:creator>joeFurbee</dc:creator>
      <dc:date>2020-01-10T01:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create a report/table relationship report?</title>
      <link>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/616930#M617</link>
      <description>&lt;P&gt;thanks Joe!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 14:36:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/616930#M617</guid>
      <dc:creator>RichardP</dc:creator>
      <dc:date>2020-01-13T14:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create a report/table relationship report?</title>
      <link>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/617481#M620</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274763"&gt;@RichardP&lt;/a&gt;. Sorry for the delay. Also, I apologize in advance if I made assumptions in this response. If you need further info, please reach out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the relationships API in combination with the reports API seems to be the way to go. I'll explain what I did and provide the code I used. Hopefully, it will give you enough info to go on. All of the APIs I used are &lt;A href="https://developer.sas.com/apis/rest/Topics/" target="_self"&gt;documented here.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the following API call to get a list of relationships:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;curl --location --request GET 'http://sasserver.demo.sas.com/relationships/relationships \
--header 'Accept: application/vnd.sas.collection+json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ........'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the response, I see the following:&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"name"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"items"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"accept"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"application/vnd.sas.relationship"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"start"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"count"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;547&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"items"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;[&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;This indicates that there are 547 relationships. Be aware that the default limit is 20 for the REST call, so I tacked on a limit to the url &amp;gt; count:&amp;nbsp;&lt;CODE class=" language-sas"&gt;curl --location --request GET '&lt;A href="http://sasserver.demo.sas.com/relationships/relationships?limit=1000" target="_blank"&gt;http://sasserver.demo.sas.com/relationships/relationships?limit=1000&lt;/A&gt;&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This made me think though that 547 is a lot more than the number of reports I had created. Also, the report name is not in the response, only the id. I then ran a request to get a list of reports:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;curl --location --request GET 'http://sasserver.demo.sas.com/reports/reports' \
--header 'Authorization: Bearer ........'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and got the response:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"name": "reports",&lt;BR /&gt;"accept": "application/vnd.sas.summary",&lt;BR /&gt;"start": 0,&lt;BR /&gt;"count": 24,&lt;BR /&gt;"items": [&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This a much more manageable number. At this point, I thought it better to get the reports first and then get the relationship based on this query. Now, I have a plethora of options to merge the results. What I decided to do was to convert the JSON responses to a csv files. Again, I have many options on scrubbing/combining the data. I used the following Python script to get a csv file with report id and name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;import json
import csv
with open('C:/Users/jofurb/reportsResponse.json','r') as myfile:
    response_data=myfile.read()
response_parsed = json.loads(response_data)
resp_data = response_parsed['items']
respon_data = open('C:/Users/jofurb/reportsResponseData.csv','w')
csvwriter= csv.writer(respon_data)
count=0
for resp in resp_data:
    if count == 0:
        header = resp.keys()
        csvwriter.writerow(header)
        count += 1
    csvwriter.writerow(resp.values())
respon_data.close()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I could then use that data along with the relationships response JSON to combine the data into a dataset I can use for the report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps,&lt;/P&gt;
&lt;P&gt;Joe&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 15:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/617481#M620</guid>
      <dc:creator>joeFurbee</dc:creator>
      <dc:date>2020-01-15T15:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create a report/table relationship report?</title>
      <link>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/618045#M630</link>
      <description>&lt;P&gt;Hi Joe,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is exactly what I was looking for. And thanks to your reply on my other&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;question&amp;nbsp;&lt;A href="https://communities.sas.com/t5/Developers/Translating-cURL-command-to-equivalent-PROC-HTTP-statement/m-p/617656/" target="_blank"&gt;https://communities.sas.com/t5/Developers/Translating-cURL-command-to-equivalent-PROC-HTTP-statement/m-p/617656/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am now able to do this directly in SAS Studio and ready the JSON response directly into a SAS data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You provided the magic tip - LIMIT= option. I was aware of the relationships API but could not see my report anywhere, this was due to the limit=20!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;many thanks ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 11:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Create-a-report-table-relationship-report/m-p/618045#M630</guid>
      <dc:creator>RichardP</dc:creator>
      <dc:date>2020-01-17T11:00:19Z</dc:date>
    </item>
  </channel>
</rss>

