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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Asynchronous refresh with the PBI API does not return a requestid

Hello,

 

I try to refresh a Power BI dataset programmatically by sending post request to PBI API endpoint: datasets/<datasetid>/refreshes.

 

The documentation (https://docs.microsoft.com/en-us/power-bi/connect-data/asynchronous-refresh) states: The response also includes a location response-header field to point the caller to the refresh operation that was just created/accepted. Location is that of the new resource which was created by the request, which includes the refreshId.

 

 

I used following Powershell code to refresh the dataset, but I don't receive a Location header. Is this a bug or expected behaviour?

 

 

 

 

Login-PowerBI
$XmlaQuery = @"
{
  "refresh": {
    "type": "full",
    "objects": [
      {
        "database": "<Datamodel>",
        "table": "<Table>"
      }
    ]
  }
}
"@

# URL is a relative or absolute URL of the Power BI entity to access. 
Invoke-PowerBIRestMethod -Url 'datasets/<datasetid>/refreshes' -Method Post -Body $XmlaQuery 

 

 

 

 

 

 

 

Status: Investigating

Hi @Anonymous 

 

I’ve tested on this API. As you can see, I run this API with Post request method and get Location and RequestId contained in Response Header.

vcazhengmsft_0-1643618090108.png

vcazhengmsft_2-1643618132055.png

 

Best Regards,

Community Support Team _ Caiyun

Comments
v-cazheng-msft
Community Support
Status changed to: Investigating

Hi @Anonymous 

 

I’ve tested on this API. As you can see, I run this API with Post request method and get Location and RequestId contained in Response Header.

vcazhengmsft_0-1643618090108.png

vcazhengmsft_2-1643618132055.png

 

Best Regards,

Community Support Team _ Caiyun

Anonymous
Not applicable

Hi @v-cazheng-msft ,

 

So I debugged this issue and came to the following conclusions:

 

- When passing no parameters in the body to POST /refreshes the entire dataset gets refreshed, but no Location is returned. Also when I send a request to GET /refreshes/RequestId including the RequestId returned by POST /refreshes, I receive an error: 

 

 

{"error":{"code":"MethodNotAllowed","message":"Operation failed - Refresh details unavailable. Dataset ID ... Refresh ID ... RefreshType is ViaApi."}}

 

This indicates that passing no parameters to POST /refreshes does not initiate an asynchronous refresh, since a GET /refreshes should then return refreshType = 'ReliableProcessing' but now returns refreshType = 'ViaApi'. 

 

- When passing parameters in the body to POST /refreshes I do now receive a valid Location and RequestId, when passing them to GET /refreshes I receive a message including RefreshType = 'ReliableProcessing'.

 

Could you please investigate the issue and get back to me

 

Kind regards,

 

shy78
New Member

I am having same issue, I use the azure Logic App to trigger the POST refresh with parameters, but is not getting the location and requestId value in the response header

shy78_0-1666854232185.png

 

Can anyone help on this? Thanks in advance 

 

Kinda Regards,

 

rajulshah
Resident Rockstar

Hello @Anonymous ,

 

Did you get the solution to this issue?

I am getting the same error.

Stefan-O
Regular Visitor

@v-cazheng-msft @Anonymous I am having the same issue when triggering a POST from Azure data factory. The RequestID in the ADF response does not match what's in PBI in the screenshots 

 

StefanO_0-1678760945713.png

 

StefanO_1-1678761048818.png

 

StefanO_2-1678761070542.png

 

 

WByrne
Frequent Visitor
I think I figured this out and it is a case of the API being very poorly documented. You have to read between the lines a bit to make sense of the example. First, it says an enhanced refresh is only triggered if a request payload other than notifyOption is set https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/refresh-dataset-in-group#:~:text=An%20e.... Next, in each example they only show a refresh being performed "Via Enhanced API" https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/refresh-dataset-in-group#examples Finally, if you look at the dataset refreshes endpoint, the docs says it returns execution details of enhanced refresh operations: https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/get-refresh-execution-details-in-group and the URL matches a similar pattern to the one given in Location in the sample response of the refresh dataset. If you try to change the request id used in the /refreshes/{refreshId} to a refresh request that is not classified as "Via Enhanced API", then you get a 405 Method Not Allowed error and an error message that reads something like: Operation failed - Refresh details unavailable. Dataset ID Refresh ID RefreshType is ViaApi.