Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Trying to use Rest API to Refresh power BI data source via PowerShell and Gateway

Hi Everyone, I'm trying to use the example code posted here to refresh my data sources in power BI through an established gateway via rest API. I am able to copy and paste the code into the PowerShe...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hi, 

    I agree that it's a powershell issue but I thought I would post here since it was in relation to Power BI. I figured out the issue on my own. These are the two pieces of code I had to update to make the sample work (in case anyone is interested in doing this too):

     

    $authHeader = @{
    Authorization=$token.CreateAuthorizationHeader()
    Content='application/json'
    }

     

    long dashes to short dashes:

    Invoke-RestMethod -Uri $uri -Headers $authHeader -Method POST -Verbose