cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
amhiggins
Frequent Visitor

Rest API Data Refresh NotifyOption

Hello, I am refreshing my published datasets via the Rest API in Python. It seems as though I cannot turn on the NotifyOption in my request. Trying to set the notifyOption to "MailOnCompletion" or "MailOnFailure" produces a 400: Bad Request result. I'm not sure if there is something wrong with my set up or if this is simply not allowed.

Here is my code:

dataset_url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/datasets"
header = {'Authorization': f'Bearer {access_token}','Content-Type':'application/json'}
url = 'https://api.powerbi.com/v1.0/myorg/groups/' + workspace_id + '/datasets/' +datasetid+ '/refreshes'
payload = {'refreshRequest':'y', 'notifyOption':'MailOnCompletion'}
data = json.dumps(payload)
response = requests.request("POST", url, headers=header, data=data)

The output of this code is:

{"error":{"code":"InvalidRequest","message":"NotifyOption parameter value is not supported for application requests","target":"Parameter value 'MailOnCompletion' is invalid for application requests"}}

If I remove the notifyOption or set notifyOption to "NoNotification" the request works fine and the desired dataset is refreshed. 

1 REPLY 1
v-jayw-msft
Community Support
Community Support

Hi @amhiggins ,

 

I can't reproduce the scenario.

You may take a look at this topic.

https://community.powerbi.com/t5/Developer/PowerBI-REST-API/m-p/1007546 

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors