I am having issues with a REST request I am trying to build in powershell. I expect this is something simple.
The expected output schema:
"shareInfo": {
"shareName": "string",
"accessControl": {
"permission": "string",
"users": [
"string"
]
}
}
My powershell code
$body = @{
shareInfo = @{
shareName = $shareName
accessControl = @{
permission = $settings.Default_Share_Permissions.Permission
users = @($settings.Default_Share_Permissions.User_Group)
}
}
}
$body = $body | ConvertTo-Json
which outputs
"shareInfo": {
"shareName": "",
"accessControl": {
"users": "Domain Users",
"permission": "full_control"
}
}
Obviously my problem is the value of permission isn't an array. There will only ever be one value there but the API requires an array to be passed. Any ideas how to overcome?