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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
satishorre20
Helper II
Helper II

Enhanced refresh with the Power BI REST API using Python - need help

Hello,

 

I hope you're all doing well. I wanted to reach out to see if anyone has had success using the enhanced refresh with the Power BI REST API to refresh datasets with specific tables in the request body. Despite following the documentation closely, I'm still encountering an issue where the request is being submitted as "via API" rather than "via enhanced API."

Has anyone attempted to use the enhanced API call with Python for refreshing the dataset? Any insights or guidance on this would be greatly appreciated.

 

Documentaiton Link : Enhanced refresh with the Power BI REST API - Power BI | Microsoft Learn

API :  Post  https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes

 

Python POST API Sample code 

url_rfsh_data = f'https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes'

headers = {
    'Authorization' : 'Bearer ' + result['access_token']
   , "Content-Type"  :"application/json"
}

payload = {  "type": "Full"
          ,  'commitMode' : 'transactional'
          ,  "maxParallelism"  : 2
          , 'retryCount' : 2
          , 'objects' : [ { "table" : " DateDim"}
                        ]
          }
response = requests.post(url_rfsh_data,headers=headers, params=payload)

 

1 ACCEPTED SOLUTION
tayloramy
Super User
Super User

Hi @satishorre20,

 

in my experienve, if the refresh shows “via API” it usually means the request didn’t include the enhanced options in the JSON body, or the dataset isn’t on Premium/PPU/Fabric. In your sample you used params=payload (query string) instead of json=payload (request body), so the service probably treated it like a standard refresh.

 

  1. Make sure the workspace is on Premium/PPU or Fabric. Shared/Pro won’t run enhanced refresh. Datasets - Refresh Dataset
  2. Send your POST with a JSON body that includes at least one enhanced property like objects, commitMode, maxParallelism, or retryCount. Enhanced refresh with the Power BI REST API
  3. Try this minimal Python example (note the json=):
import requests

url = f"https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes"
headers = {
  "Authorization": f"Bearer {result['access_token']}",
  "Content-Type": "application/json"
}
payload = {
  "type": "Full",
  "commitMode": "transactional",
  "maxParallelism": 2,
  "retryCount": 2,
  "objects": [ { "table": "DateDim" } ]
}
r = requests.post(url, headers=headers, json=payload) # <-- use json, not params
print(r.status_code, r.text)​


Reference examples and parameters here: Enhanced refresh

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
Taylor Amy.





If you found this helpful, consider giving some Kudos.
If I answered your question or solved your problem, mark this post as the solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
tayloramy
Super User
Super User

Hi @satishorre20,

 

in my experienve, if the refresh shows “via API” it usually means the request didn’t include the enhanced options in the JSON body, or the dataset isn’t on Premium/PPU/Fabric. In your sample you used params=payload (query string) instead of json=payload (request body), so the service probably treated it like a standard refresh.

 

  1. Make sure the workspace is on Premium/PPU or Fabric. Shared/Pro won’t run enhanced refresh. Datasets - Refresh Dataset
  2. Send your POST with a JSON body that includes at least one enhanced property like objects, commitMode, maxParallelism, or retryCount. Enhanced refresh with the Power BI REST API
  3. Try this minimal Python example (note the json=):
import requests

url = f"https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes"
headers = {
  "Authorization": f"Bearer {result['access_token']}",
  "Content-Type": "application/json"
}
payload = {
  "type": "Full",
  "commitMode": "transactional",
  "maxParallelism": 2,
  "retryCount": 2,
  "objects": [ { "table": "DateDim" } ]
}
r = requests.post(url, headers=headers, json=payload) # <-- use json, not params
print(r.status_code, r.text)​


Reference examples and parameters here: Enhanced refresh

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
Taylor Amy.





If you found this helpful, consider giving some Kudos.
If I answered your question or solved your problem, mark this post as the solution!

Proud to be a Super User!





Thank you @tayloramy it worked

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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

Top Solution Authors