Forum Discussion
Anonymous
4 years agoNot applicable
[REST API] Datasets Take Over: Positional Parameter cannot be found that accepts argument 'Method'
Getting the following error when trying to take over dataset using this REST API: https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/take-over-in-group Following is my code: ...
Anonymous
4 years agoNot applicable
Getting the same error after replacing -POST with POST:
lbendlin
4 years agoSuper User
Please read my reply again. Use -Method (note the dash)
- Anonymous4 years agoNot applicable
Thank you, I changed the code but getting this new error now:
Invoke-PowerBIRestMethod -Url $Url -Headers $authHeader -Body $jsonPostBody -Method POST -Verbose
- lbendlin4 years agoSuper User
Looks like
Get-PowerBIAccessToken -AsString
returns more than you need. Investigate that and then only use the auth part.
most likely
$authHeader = @{
'Content-Type'='application/json'
'Authorization'=$token.Values[0]
}- lbendlin4 years agoSuper User
Hmm, maybe the issue is elsewhere. Both
Connect-PowerBIServiceAccount $headers = Get-PowerBIAccessToken -AsString $authHeader = @{ 'Content-Type'='application/json' 'Authorization'=$headers } Invoke-RestMethod -Headers $authHeader -Uri 'https://api.powerbi.com/v1.0/myorg/groups'and
Connect-PowerBIServiceAccount $headers = Get-PowerBIAccessToken Invoke-RestMethod -Headers $headers -Uri 'https://api.powerbi.com/v1.0/myorg/groups'work for me.
Maybe Invoke-PowerBIRestMethod is the culprit. Use Invoke-RestMethod instead.