maikvandergaag / msft-extensions

Repository for extensions mainly used for Azure DevOps Extensions
https://msftplayground.com
MIT License
126 stars 80 forks source link

The correct json body for updating Refresh Schedule with REST API #505

Closed liushuanggang closed 8 months ago

liushuanggang commented 9 months ago

When I using the REST API to update the Refresh Schedule:

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

I need the specify settings for the schedule like below:

enter image description here

But when I using below json body (Get it By F12):

{'value': {'notifyOption':'NoNotification', 'enabled': true, 'isDaily':true,'times': ['07:00'],'localTimeZoneId': 'UTC','refreshNotificationEnabled':false,'refreshContacts':[{'displayName':'xx Leoxx','objectId':'06211a47-86a2-48e7-8840-1984efbfb0d5','userPrincipalName':'My E-mail.com','isSecurityGroup':false,'objectType':1,'groupType':0,'aadAppId':null,'emailAddress':'My E-mail.com','relevanceScore':null,'creatorObjectId':null}]}}

It always prompts me that the json is not correct.

According to my understanding of the contact, it seems that it needs to display the name and object ID after verification during the input process, which seems to be impossible to obtain in advance? Or the objectId is bound to my personal account and will not be regenerated due to different deployment targets.

Anyway, I would like to have a correct json body. Please give me a json body that exactly matches my screenshot settings and verifies that it works, it has been driving me crazy for a day. thank you very much.

Note: I have already checked the body from the REST API, that is the old one, what I need is that:

  1. Daily instead of certain days(Sunday,Tuesday,Friday).
  2. Need include the contact person who will send the notification when it fails.
liushuanggang commented 9 months ago

I also found that document "Service principals only support the NoNotification value.", learn.microsoft.com/en-us/rest/api/power-bi/datasets/…. So, I do not know which one is correct. Could you give any suggestion?

maikvandergaag commented 9 months ago

The correct body is found here:

https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-refresh-schedule#refreshschedule

When using a service principal as the authentication mechanism you cannot supply the notification

maikvandergaag commented 8 months ago

No response any more