User Profile
Danny_B855
Copper Contributor
Joined May 30, 2019
User Widgets
Recent Discussions
Re: REST API Request Using Invoke-RestMethod
Danny_B855Here's the last thing I tried: $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("Authorization", 'Basic ' + $encodedCreds) $headers.Add("Content-Type", "application/octet-stream`r`n<show system uptime>`r`n<show system version>") $Response = Invoke-RestMethod "https://1.2.3.4/api/v1/files/cliScript/incremental" -Headers $headers -Method Put Error: Invoke-RestMethod : Specified value has invalid CRLF characters.12KViews0likes1CommentREST API Request Using Invoke-RestMethod
I'm having a devil of time formatting a request to a REST API. I've tried twenty different ways of passing the request information in headers\body using Invoke-RestMethod. Here's what the request needs to look like: PUT /api/v1/files/cliScript/incremental Content-Type: application/octet-stream <show system uptime> <show system version> I can't figure out how to pass these SHOW SYSTEM commands. Has anyone tackled something like this before?12KViews0likes2Comments
Recent Blog Articles
No content to show