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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
smpa01
Super User
Super User

Unable to refresh dfg2 cicd programatically

##fails
requests.post("https://api.fabric.microsoft.com/v1/workspaces/<ws_id>" + '/dataflows'+'/<df_id>'+"/jobs/instances", headers={"authorization": "Bearer " + token},params = {"jobType": "Refresh"}  )

 

##fails
payload = {
    "executionData":{
        "DataflowName": "dfg2test", 
        "OwnerUserPrincipalName": "user@company.com", 
        "OwnerUserObjectId": "<df_id>" 
    }
}
token = get_token()
req = requests.post("https://api.fabric.microsoft.com/v1/workspaces/<ws_id>" + '/dataflows'+'/<df_id>'+"/jobs/instances", headers={"authorization": "Bearer " + token},params = {"jobType": "Refresh"}, data=payload  )

I am not being able to refresh dfgen2 programmatically, I follwed https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-public-apis#get-dataflow and https://learn.microsoft.com/en-us/rest/api/fabric/core/job-scheduler/run-on-demand-item-job?tabs=HTT... 

I am getting this. I can manually refesh it as well as through scheduled jobs

There was a problem refreshing the dataflow: 'Something went wrong, please try again later. If the error persists, please contact support.'. Error code: UnknowErrorCode. (Request ID: 37753040-f20b-49d9-a04e-bc589ab12eaf).

 

Using the same SPN, I am able to execute List Dataflows 

 

The more contradictory part of the documentation is Run On Demand Item Job (says SPN can consume endpoint) vs Run On Demand Execute (says SPN can't consume endpoint) 

 

My question is - 

  1. Can a SPN programmatically run a refresh df g2 cicd
  2. If yes, what am I doing wrong?

@miguel 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
1 ACCEPTED SOLUTION
miguel
Community Admin
Community Admin

The on demand execute endpoint documentation is correct. SPN is not supported just yet. 

You can request this through the ideas site for prioritization:

https://aka.ms/FabricIdeas

 

View solution in original post

1 REPLY 1
miguel
Community Admin
Community Admin

The on demand execute endpoint documentation is correct. SPN is not supported just yet. 

You can request this through the ideas site for prioritization:

https://aka.ms/FabricIdeas

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.