<?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: Problem setting CacheOptions and expiration schedule via REST API (V2.0) in C#/Swagger API in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1121688#M14345</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/220868"&gt;@lsteffens&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Funny that the "official" REST API documentation has this bug and I wonder why the REST API names are case sensitive at all ... ^^&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well JSON is a case-sensitive format so it makes sense that ScheduleId and ScheduleID are treated differently, but I don't know how that bug would have slipped into the docs on Swaggerhub I would have expected those to be generated from somewhere&lt;/P&gt;</description>
    <pubDate>Wed, 27 May 2020 07:51:44 GMT</pubDate>
    <dc:creator>d_gosbell</dc:creator>
    <dc:date>2020-05-27T07:51:44Z</dc:date>
    <item>
      <title>Problem setting CacheOptions and expiration schedule via REST API (V2.0) in C#/Swagger API</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1098805#M14274</link>
      <description>&lt;P&gt;I use the downloaded and compiled Swagger API for Power BI Resort Server and I'm able to list content (e.g. Reports) (GET request) or upload content (e.g. PBIReport or paginated report) (POST request) using C#.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I have problems updating items with the REST API (PUT request):&lt;/P&gt;&lt;P&gt;For example I need to update the CacheOptions of a (paginated) report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the relevant code fragments:&lt;/P&gt;&lt;P&gt;1.: get the ReportsAPI client object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// get the ReportsAPI client object
var client = new ReportsApi(apiString);&lt;/LI-CODE&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;... do authentication (Forms) and get a report object (I ommited the code ...) ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.: get the CacheOptions object of a uploaded paginated report&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// works - I get the CacheOptions object
CacheOptions co = client.GetReportCacheOptions(report.Id.ToString());&lt;/LI-CODE&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;3.: immediately try to update the report by setting the CacheOptions object (unmodified in this sample) on the report&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// does not work - I get an exception inside of the Swagger API
client.SetReportCacheOptions(report.Id.ToString(), co); // just a test ...&lt;/LI-CODE&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;On step 3. I have the problem that an exception within Swagger ReportsAPI is thrown:&lt;/P&gt;&lt;P&gt;The property 'ScheduleId' does not exist on type 'Model.ScheduleReference'. Make sure to only use property names that are defined by the type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying to redo the steps with the help of Postman gives me a error 500 (internal server error) when trying to put a CacheOption JSON in the raw body (URL="&lt;SPAN&gt;https://myserver/reports/api/v2.0/Reports(690f6c2a-8995-4d29-bbd4-a4b2cc839bcb)/CacheOptions"&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this kind of problem while using this coding approach not only for CacheOptions but for all other PUT requests I tested.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe someone can help me out with this?&lt;/P&gt;&lt;P&gt;Thanks, Lars&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 12:14:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1098805#M14274</guid>
      <dc:creator>lsteffens</dc:creator>
      <dc:date>2020-05-20T12:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem setting CacheOptions and expiration schedule via REST API (V2.0) in C#/Swagger API</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1099592#M14276</link>
      <description>&lt;P&gt;Are you setting the Content-Type on the PUT request to "application/json" ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I turned on the dev tools in my browser then grabbed the url and body of the request and replayed it in Powershell using the following and I can change the cache expiration minutes and see it reflected in the UI&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;$body = '{"Id":"00000000-0000-0000-0000-000000000000","ExecutionType":"Cache","Expiration":{"Minutes":15,"Schedule":null}}'

$url = "http://localhost/reports/api/v2.0/reports(ab44aa41-496e-47a2-8ad5-fd5f8b8428fc)/CacheOptions"

$res = Invoke-RestMethod -Method Put -Uri $url -UseDefaultCredentials -Body $body -ContentType "application/json"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 22:35:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1099592#M14276</guid>
      <dc:creator>d_gosbell</dc:creator>
      <dc:date>2020-05-20T22:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problem setting CacheOptions and expiration schedule via REST API (V2.0) in C#/Swagger API</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1121544#M14341</link>
      <description>&lt;P&gt;Thanks for your post - it was really helpful as I got a working body text for postman to get to the real error (inside the swagger API).&lt;/P&gt;&lt;P&gt;I already set the content type for the body to raw and JSON in postman and the swagger API does set it correctly, too. There was something wrong with the body test I used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The real problem was that in my tests I use a schedule defined in power bi ui and did not give the expiration schedule in the body of my request (like you did in your sample ...).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While debugging the Swagger API for power bi I noticed that the "ScheduleID" is used case sensitive in the REST API request.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Swagger made this request body:&lt;/P&gt;&lt;P&gt;This does not work as "ScheduleId" is wrong:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"ExecutionType":"Cache","Expiration":{"Minutes":0,"Schedule":{"ScheduleId":"e4bd295b-15b6-4986-9376-aa890fe937d1"}}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works correct:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"ExecutionType":"Cache","Expiration":{"Minutes":0,"Schedule":{"ScheduleID":"e4bd295b-15b6-4986-9376-aa890fe937d1"}}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Funny that the "official" REST API documentation has this bug and I wonder why the REST API names are case sensitive at all ... ^^&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need to solve the problem in the Swagger C# Schedule class and use the correct name ...&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 07:05:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1121544#M14341</guid>
      <dc:creator>lsteffens</dc:creator>
      <dc:date>2020-05-27T07:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem setting CacheOptions and expiration schedule via REST API (V2.0) in C#/Swagger API</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1121688#M14345</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/220868"&gt;@lsteffens&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Funny that the "official" REST API documentation has this bug and I wonder why the REST API names are case sensitive at all ... ^^&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well JSON is a case-sensitive format so it makes sense that ScheduleId and ScheduleID are treated differently, but I don't know how that bug would have slipped into the docs on Swaggerhub I would have expected those to be generated from somewhere&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 07:51:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1121688#M14345</guid>
      <dc:creator>d_gosbell</dc:creator>
      <dc:date>2020-05-27T07:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem setting CacheOptions and expiration schedule via REST API (V2.0) in C#/Swagger API</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1121743#M14347</link>
      <description>&lt;P&gt;As a follow up ....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to change "ScheduleId" to "ScheduleID" in this code row in "ScheduleReference.cs" of the downloaded C# Swagger API:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[DataMember(Name="ScheduleID", EmitDefaultValue=false)]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... and it works in my case.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 08:11:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1121743#M14347</guid>
      <dc:creator>lsteffens</dc:creator>
      <dc:date>2020-05-27T08:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem setting CacheOptions and expiration schedule via REST API (V2.0) in C#/Swagger API</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1122167#M14356</link>
      <description>&lt;P&gt;I've flagged this with some contacts I have at Microsoft to see if they can get SwaggerHub corrected.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 11:01:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Problem-setting-CacheOptions-and-expiration-schedule-via-REST/m-p/1122167#M14356</guid>
      <dc:creator>d_gosbell</dc:creator>
      <dc:date>2020-05-27T11:01:36Z</dc:date>
    </item>
  </channel>
</rss>

