I need to send a curl request from powershell, using box api reference for help (I'm looking the the section called Update User
, but I'm having some trouble:
curl https://api.box.com/2.0/users/11111 -H @{"Authorization" = "token"} -d '{"name": "bob"}' -X PUT
Should update the user's name, but I get:
Invoke-WebRequest : A positional parameter cannot be found that accepts argument '{"name": "bob"}'. At G:\IT\bassie\Box\GetUsers.ps1:5 char:1 + curl https://api.box.com/2.0/users/892861590 -H @{"Authorization" = " ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
I tried re-arranging it to
-d @{"name" = "bob"}
but the error changed to
Invoke-WebRequest : A positional parameter cannot be found that accepts argument 'System.Collections.Hashtable'. At G:\IT\bassie\Box\GetUsers.ps1:5 char:1 + curl https://api.box.com/2.0/users/892861590 -H @{"Authorization" = " ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
What do I need to put into the -d
parameter?