Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Asynchronous refresh with the PBI API, unable to locate refreshid from POST to refreshes

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 need to fetch the refreshid but I don't know how.

 

I used following Powershell code to refresh the dataset:

Please let me know how I can fetch the refreshid, thanks in advance!

 

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 

 

 

 

 

4 Replies

  • Run 

    Invoke-PowerBIRestMethod -Url 'datasets/<datasetid>/refreshes' -Method GET 

    after posting the request.  That will give you the requestid and the status.

  • Anonymous's avatar
    Anonymous
    Not applicable

    This has not been solved. If the documentation state that a requestId is returned in the Location header there should be an easy implementation right? 

    please let me know!