Questions tagged [invoke-restmethod]

129 questions
0
votes
1 answer

Sending an HTTPS Request from an Azure Function to an external Web Service using a Certificate

A hearty hello to everyone! I have set up an Azure Function App (S1 SKU) and I am trying to use one of the functions as a client that sends an HTTPS-Request to another web server (API). I do this using the Powershell Cmdlet Invoke-RestMethod which I…
0
votes
1 answer

Powershell: Invoke-RestMethodt delivers an unexpected empty line

I am sending a query with Invoke-WebRequest and want to output a value from the response header. For this I wrote a function that contains the following query: Invoke-RestMethod @Params -ResponseHeadersVariable ResponseHeader The Result as…
Gill-Bates
  • 559
  • 8
  • 22
0
votes
0 answers

How to send long HTML as part of JSON body in Invoke-RestMethod Powershell?

I am trying to add HTML as a value in JSON body in below code in PowerShell. It gives 400 Bad Request. The HTML content contains lots of ampersands, quotes, commas etc. due to which this fails. The same code works if I used simple strings instead of…
Ghanendra
  • 341
  • 2
  • 13
0
votes
1 answer

Parsing Invoke-Restmethod XML SOAP Request (Risport70 CUCM if that helps)

I've run into a weird scenario when trying to pull real time info on phones. I can grab the data just fine and drill down into it but run into an issue I'm not sure how to work around. Here's a sample XML response Cisco provides. After
sdcrytek
  • 25
  • 5
0
votes
1 answer

Powershell Invoke-RestMethod : body content is not interpreted correctly when send PUT Request

I have built a PUT Request using Invoke-RestMethod in a powershell script. This request looks like : # Main global var $securePassword = ConvertTo-SecureString -String $pat -AsPlainText $credential = [PSCredential]::new($username,…
french_dev
  • 2,117
  • 10
  • 44
  • 85
0
votes
0 answers

PingOne /attributes endpoint throwing error for multiple valued body

I was trying to add few new attributes to a PingOne application using this endpoint. Since it doesn't support any kind of powershell I am trying to add values using the /environments/{{sourceEnvID}}/applications/{{appID}}/attributes endpoint with…
Amal Ps
  • 703
  • 7
  • 19
0
votes
0 answers

Powershell Invoke-RestMethod sight engine Image API

Working code for URL Image moderation. It's not working for local images. I get a "remote server return error (400) Bad Request" I am not sure if I should convert the images to bytes. Any help is appreciated. # Import necessary modules # Set your…
premo103
  • 3
  • 2
0
votes
1 answer

Error when calling Invoke-RestMethod with powershell: The JSON value could not be converted to System.String. How can I Solve this?

I'm trying to call an API that I created, using Azure DevOps pipelines (yaml file), and in it I need to pass in the headers the Authorization with Bearer token coming from the devops library and in the body the project that comes from…
0
votes
1 answer

Powershell/PowerCLI, Horizon REST-API, invoke-restmethod returns "BAD_REQUEST The input request cannot be parsed"

I'm trying to copy Horizon application pools that exist on a source Horizon connection server (HCS) to another one. In my homelab that works perfectly, in another environment on "invoke-restmethod" I run into the error above. First I get an auth…
0
votes
0 answers

Converting powershell invoke-restmethod to python requests call

I'm trying to convert the following powershell script into a python script and I'm having trouble understanding the invoke-restmethod command and in particular, what to do with the -body parameter. The powershell script is an example given to me by…
Paul
  • 13
  • 3
0
votes
1 answer

Best way to assign data in hashtable where data is missing for some objects but not others

I am using Powershell 7 to invoke-RestMethod on a JIRA insight API server version (non-cloud). While my invoke rest works like a charm, I am unsure how to approach this as each object's attributes are dynamic based on user input from the front end…
sdcrytek
  • 25
  • 5
0
votes
0 answers

How to upload a file as binary data while using RestAPI through powershell like we use --data-binary in curl

I'm trying to upload a file on an API using RESTAPI method and using powershell task in Azure DevOps. I'm able to upload the file but still there is some issue with the file. I'm now trying to upload this file as a binary file on that API but I'm…
gaurav sharma
  • 91
  • 1
  • 10
0
votes
1 answer

connecting to azure rest api using powershell resulting in StatusCode : 203 StatusDescription : Non-Authoritative Information

I am able to connect fine to azure API's using a PAT token in postman, however am not able to authenticate using powershell. After playing around with different authorization passing I am still stuck with getting the html page for the sign in…
J.Doe
  • 155
  • 1
  • 9
0
votes
0 answers

Invoke-RestMethod Making Double Calls

We are calling an API within ActiveBatch with the following PowerShell. $refreshResponse = Invoke-RestMethod -Uri $psApiUri -Headers $authHeaders -Method 'GET' When this is used to call the dev environment version of the endpoint it works fine.…
MrTCS
  • 177
  • 2
  • 8
0
votes
1 answer

How to upload a file to a web server

I'm trying to send different types of files to myself over my local network using PowerShell. I think I'm onto something with the command; Invoke-RestMethod -Uri http://192.168.0.164:8000/upload -Method Post -InFile "file.txt"` But sadly, I get…
MegaMagnum
  • 43
  • 9
1 2 3
8 9