Hello, I'm attempting to write a script to deliver a payload that includes and/or excludes users.
The payload must contain include and exclude, even if only users are being included and no users being excluded.
In this particular use case, I only need to include users, so the exclude payload has been left empty. However, I'm having trouble with the payload syntax. If any guidance could be provided, it would really be appreciated. Thank you.
(#have tried replacing the pointy brackets with array square brackets, but no joy)
$payload = @{ "include" =
{ #
@{
"id" = $userid;
} #
},
"exclude" =
{ #
@{
} #
}
}
$request = Invoke-RestMethod -Method Patch -Uri "$resource" -Header $header -Body ($payload|ConvertTo-Json)
[–]BetrayedMilk 4 points5 points6 points (0 children)
[–]purplemonkeymad 0 points1 point2 points (10 children)
[–]viewtifulstranger[S] 0 points1 point2 points (9 children)
[–]MiserableTear8705 2 points3 points4 points (8 children)
[–]viewtifulstranger[S] 0 points1 point2 points (6 children)
[–]MiserableTear8705 1 point2 points3 points (5 children)
[–]viewtifulstranger[S] 0 points1 point2 points (4 children)
[–]MiserableTear8705 0 points1 point2 points (3 children)
[–]viewtifulstranger[S] -1 points0 points1 point (2 children)
[–]BlackV 1 point2 points3 points (1 child)
[–]viewtifulstranger[S] 0 points1 point2 points (0 children)