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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Alexander24
Helper II
Helper II

Set Parameters API returning error - Dataset Parameters list is invalid - Reason Empty

Hi

I have created the following PowerShell Script to set parameters for a dataset , it returns the list is empty even though its not, the parameters list is a list I created in Power Query and referenced as query in the manage parameters section

 

Help would be appreciated - this is the error  

 

VERBOSE: POST https://api.powerbi.com/v1.0/myorg/groups/e7229a42-46ef-4d80-b8ca-e42909509dbb/datasets/68fbeff4-ce6...
ers with -1-byte payload
VERBOSE: received -1-byte response of content type application/octet-stream
updateDetails                  
-------------                  
{@{name=Type; newValue=Product}}

 


error : @{code=InvalidRequest; message=Dataset Parameters list is invalid in 68fbeff4-ce61-43d4-8f8d-74dcd1452393. Reason: Empty;
        target=68fbeff4-ce61-43d4-8f8d-74dcd1452393}

 

 

This is the Script

$clientId = "ab3afa9b-c31f-41ed-bdc9-84c9c68069b9"


$groupID = "e7229a42-46ef-4d80-b8ca-e42909509dbb" # the ID of the group that hosts the dataset. Use "me" if this is your My Workspace
$datasetID = "68fbeff4-ce61-43d4-8f8d-74dcd1452393" # the ID of the dataset that hosts the dataset
$json = @"
{   "updateDetails": [

    {
      "name": "Type",
      "newValue": "Product"
    }
    ]
    }

"@

$powershellrepresentation = $json | ConvertFrom-Json

$powershellrepresentation


function GetAuthToken
{
    $adal = "${env:ProgramFiles}\WindowsPowerShell\Modules\AzureRM.profile\4.5.0\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
   
    $adalforms = "${env:ProgramFiles}\WindowsPowerShell\Modules\AzureRM.profile\4.5.0\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"
 
    [System.Reflection.Assembly]::LoadFrom($adal) | Out-Null

    [System.Reflection.Assembly]::LoadFrom($adalforms) | Out-Null

    $redirectUri = "urn:ietf:wg:oauth:2.0:oob"

    $resourceAppIdURI = "https://analysis.windows.net/powerbi/api"

    $authority = "https://login.microsoftonline.com/common/oauth2/authorize";

    $authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority

    $authResult = $authContext.AcquireToken($resourceAppIdURI, $clientId, $redirectUri, "Auto")

    return $authResult
}

# Get the auth token from AAD
$token = GetAuthToken

# Building Rest API header with authorization token
$authHeader = @{
   'Content-Type'='application/json'
   'Authorization'=$token.CreateAuthorizationHeader()
}

# properly format groups path
$groupsPath = ""
if ($groupID -eq "me") {
    $groupsPath = "myorg"
} else {
    $groupsPath = "myorg/groups/$groupID"
}

# POST body
$postParams = $powershellrepresentation

$jsonPostBody = $postParams | ConvertTo-Json

# Make the request to clone the report
$uri = "https://api.powerbi.com/v1.0/$groupsPath/datasets/$datasetID/UpdateParameters"
try{$resp=Invoke-RestMethod -Uri $uri -Headers $authHeader -Method POST -Body $jsonPostBody -Verbose}
  catch {
        $streamReader = [System.IO.StreamReader]::new($_.Exception.Response.GetResponseStream())
        $ErrResp = $streamReader.ReadToEnd() | ConvertFrom-Json
        $streamReader.Close()
    }

    $ErrResp | Format-list

1 ACCEPTED SOLUTION
v-micsh-msft
Microsoft Employee
Microsoft Employee

Hi,

 

Please check the thread below:

https://community.powerbi.com/t5/Developer/Get-Dataset-Parameters-from-REST-API-for-Direct-Query-Dat...

 

Have you checked the Enable Load for the parameters under Query editor?

 

The parameter may not be loaded when publish to Power BI service.

 

Regards,

Michael

 

View solution in original post

2 REPLIES 2
v-micsh-msft
Microsoft Employee
Microsoft Employee

Hi,

 

Please check the thread below:

https://community.powerbi.com/t5/Developer/Get-Dataset-Parameters-from-REST-API-for-Direct-Query-Dat...

 

Have you checked the Enable Load for the parameters under Query editor?

 

The parameter may not be loaded when publish to Power BI service.

 

Regards,

Michael

 

Thanks this was the issue

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.