I am trying to Call a candidate to test these new API calls, as I am totally unfamiliar with REST. I have read as much as my brain can handle...
Eventually this will be used to POST and GET backups for our SQL database imports.
I have tried quite a few methods all with no success.
Error: "Invoke-RestMethod : Cannot bind parameter 'Headers'. Cannot convert the "authorization: Token 297fecXXXXXXXXXXXXXXd31eff5" value of type "System.String" to type
"System.Collections.IDictionary"."
Error:
Invoke-WebRequest : A positional parameter cannot be found that accepts argument ' Authorization: Token 297fecXXXXXXXXXXXXXXd31eff5'.
At line:4 char:11
+ $result = Invoke-WebRequest -Uri $url $cred -Method GET -ContentTyp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Error:
Invoke-RestMethod : Cannot bind parameter 'Headers'. Cannot convert the "authorization: Token
297fecXXXXXXXXXXXXXXd31eff5" value of type "System.String" to type "System.Collections.IDictionary".
At line:1 char:35
+ ... hod GET -h 'authorization: Token 297fecXXXXXXXXXXXXXXd31eff5' - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-RestMethod], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Error:At line:3 char:42
+ Invoke-RestMethod -Method GET -header @{-x = 'authorization: Token 2 ...
+ ~
The hash literal was incomplete.
At line:3 char:102
+ ... -x = 'authorization: Token 297fecXXXXXXXXXXXXXXd31eff5'} -Uri ht ...
+ ~
Unexpected token '}' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : IncompleteHashLiteral