Put a parameter in a API REST Power BI?

Hello,

Is there any way to put a parameter that retrieves a workspace id in the URL of a Power BI REST API ?

$workspace = New-PowerBIWorkspace -Name "WKS TEST"

Add-PowerBIWorkspaceUser -Id $workspace.Id -UserEmailAddress blablablabla -AccessRight Admin

$body ='{"capacityId":"blablablabla"}'
Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/groups/$workspace.Id/AssignToCapacity" -Method Post -Body $body

Below is the code I use.

And here is the error

As you’re trying to access a property in double quotes, you will need a sub-expression:

Invoke-PowerBIRestMethod -Url "https://api.powerbi.com/v1.0/myorg/groups/$($workspace.Id)/AssignToCapacity" -Method Post -Body $body