Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Power BI API doesn't disable Direct Query, but example on reference says it should

There seems to either be a bug with the documentation or with the API.

https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/update-direct-query-refresh-schedule 

 

When sending the "Disable a scheduled refresh example" I get:

 

{
  "error": {
    "code": "BadRequest",
    "message": "Bad Request",
    "details": [
      {
        "message": "Value cannot be null.\r\nParameter name: nullableType",
        "target": "datasetDQRefreshSchedule"
      }
    ]
  }
}

 


This is possibly an API error, since I get it directly from a Power Shell call, but if Direct Queries cannot have their Dashboard Tile and Metric Refresh disabled this way, it should be mentioned.

Paurian_0-1663094672610.png


Is there something that I'm missing here?

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @Anonymous ,

 

as you have noticed the API does not affect the Caching in DQ mode that helps to pre-populate Dashboard and Reports.
From my knowledge you can use this setting:

861D9CA8-B281-47AF-B061-835F3064ED15.jpeg

You will find this setting in the dataset settings, of course this setting is only available for DQ datasets.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey @Anonymous ,

 

as you have noticed the API does not affect the Caching in DQ mode that helps to pre-populate Dashboard and Reports.
From my knowledge you can use this setting:

861D9CA8-B281-47AF-B061-835F3064ED15.jpeg

You will find this setting in the dataset settings, of course this setting is only available for DQ datasets.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Hi @TomMartens Thanks for your response. I'm looking for a way to turn off the "Automatic dashboard tile and metric refresh" setting through the API. The documentation for DirectQueryRefresh (linked in the OP) states that you can do this ... but doing so has always created an HTTP 415 response. Looking through the C# source code (PowerBI-CSharp/DatasetsOperationsExtensions.cs at master · microsoft/PowerBI-CSharp · GitHub) I notice that the API command takes a DirectQueryRefreshSchedule object (serialized from the JSON payload) but that object doesn't take an "enabled" property (PowerBI-CSharp/DirectQueryRefreshSchedule.cs at b5882f53a7f5704fe70cbfb862b829e5bfc46472 · microsoft...)

public DirectQueryRefreshSchedule(frequency, days, times, localTimeZoneId)


This leads me to believe that either the documentation is faulty or that the API program is incomplete or that the behavior of something that intercepts the "enabled" setting isn't fully defined in the documentation (or is faulty).

I'm hoping someone out there can help me track down what exactly is going on and provide a way to modify this setting through automation.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors