cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI REST API - notify on refresh failure not working

I am successfully using the "Refresh Dataset In Group" API:

https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/refreshdatasetingroup

 

To get the access token, I am using grant_type=password, and supplying the user name and password of an AAD account. That AAD account is an "owner" of the registered app making the API call.

 

In the call to refresh the dataset, I am including the following in the request body:

{
    'notifyOption': 'MailOnFailure'
}

However, it has happened several times that my API call triggered a dataset refresh, then the dataset refresh failed; and I never received any email notification. Please help!

 

I have assumed that with the "notifyOption" I used above, if the refresh fails, then it would send an email notification to the user who obtained the access token. Is that the case? The API documentation says "Mail notification options (success and/or failure, or none)," but it does not actually the behavior of the various notify options.

 

Status: New
Comments
kevhav
Continued Contributor

I tried switching it to 'MailOnCompletion', and I also do not receive any email notification following a successful refresh.

v-qiuyu-msft
Community Support

Hi @kevhav,

 

I have reported this issue internally: CRI 78714405. Will update here once I get any information. 

 

Best Regards,
Qiuyun Yu 

v-qiuyu-msft
Community Support

Hi @kevhav,

 

Please run Fiddler with below option turned on, then repeat the steps to reproduce the issue. Share .saz file with us. 

 

Fiddler.PNG

 

Best Regards,
Qiuyun Yu 

kevhav
Continued Contributor

 @v-qiuyu-msft, can I send it to you in a private message? Or something like that?

kevhav
Continued Contributor

Hi @v-qiuyu-msft,

 

I tested this in Postman, with Fiddler running, to get the HTTP trace data for you.

 

However, when I tested it with Postman, it worked! I did receive an email notification, after the dataset refresh failed.

 

Normally, I am calling the API with a Python script, using Python's "requests" library. I tried some different things, and I discovered that the issue was with my Python syntax. 

 

In Python, I had been creating the body of the HTTP request as a JSON type, like this:

httpBody = {
    'notifyOption': 'MailOnFailure'
}

I figured the above would work, because in Python, it works to create the HTTP headers as a JSON type.

 

But I was wrong! After I changed the HTTP body to a string type, it fixed it...like this:

httpBody = '{\"notifyOption\": \"MailOnFailure\"}'

So, you can close this. Thanks.

jgongil
Regular Visitor

Dear PBI team,

 

I understand that this notification option, which is available when requesting a dataset refresh, will only get to the owner of the dataset.

The approach we are looking for in my case, is to be able to inform all users of the workspace once the dataset refresh is complete.

We´ll populate the relevant Azure SQL, and then through this REST API call we´ll will request the dataset refresh. Therefore, triggering a notification for the users would be required.

 

Many thanks in anticipation,