Questions tagged [invoke-restmethod]

129 questions
0
votes
0 answers

Curl command to Patch in powershell with Invoke-RestMethod?

I totally beginner with powershell and I need to create a curl command in powershell. Currently, in bash my script works fine with : curl -X PATCH --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ "foo":[ \…
Morph59
  • 33
  • 3
0
votes
1 answer

RestApi Excel file upload (update) corrupts the file

I have the following PowerShell scrip which reads an .xlsx input file from the file system and uploads it to a page in Confluence: Param ( [Parameter(Mandatory=$true)] [string]$userName, [Parameter(Mandatory=$true)]…
0
votes
0 answers

Invoke-restmethod : create GET call without BODY with nested parameters

I have the following call that works well on postman: { "action": { "name": "", "parameters": [ { "": "", "": "", "from_date": "", …
Amir
  • 1
  • 2
0
votes
1 answer

Powershell Can I loop multiple -headers Invoke-RestMethod?

I'm a newbie at powershell/programming in general and currently attempting to update admin passwords on Chatsworth CPI PDUs. The PDUs are daisy-chained together and accessed through the primary/alternate PDU IPs. Each PDU has a unique identifier…
0
votes
1 answer

Issue with Invoke-RestMethod and JiraPS module

I'm using the JiraPS module and I have already raised a bug for this issue, however I'm trying to work around it. I am using Jira Cloud and have found some gaps between how Jira Server and Jira Cloud operate (namely on things like using username for…
Xanderu
  • 747
  • 1
  • 8
  • 30
0
votes
1 answer

Powershell Invoke-RestMethod with body begins from array

I have a web server that responds to a request https://localhost/GetUpdateInfo with a body [{"ipAddress": "10.200.2.55"}] In postman its Work but in powershell i can`t do this because body begins from array. When i do exmple code: $Url =…
0
votes
1 answer

Invoke-RestMethod loop at page 0 (sometimes)

I am invoking an REST API to assemble a .csv with users of software products, but sometimes it got stuck on page 0 and providing the same information again and again until the taskscheduler stops the script. Running on PS version 5.1 and below is…
userM
  • 1
  • 1
0
votes
1 answer

Using Invoke-restmethod gives "access to the path is denied

I am trying to send a file via multipart formdata via invoke-restmethod. I don't have write permmision on the server but type filename works fine My command is Invoke-RestMethod -Uri url -Method Post -infile file
Nnnnn
  • 1
  • 1
0
votes
0 answers

Convert curl command into Invoke-ResMethod or Invoke-WebRequest

The following command works in Ubuntu box: curl -X GET "https://panorama.domain.com/api/?key=LUFRPTxxxxx&type=commit&action=partial&cmd=USERNAME but it doesn't in the same box…
Alex
  • 75
  • 7
0
votes
1 answer

How to change a powershell Invoke-RestMethod body from its original format into something else

I have a param section of a Invoke-RestMethod that i have to keep as is, but also add parameters: $param = @{ ... Body = '{"entry":[{"@name":SOMETEXT,"static":{"member":[ANOTHERTEXT]}}]}' ... } Since the entire Body is in single quotes, any…
Alex
  • 75
  • 7
0
votes
1 answer

PowerShell - Invoke-RestMethod with text and file

I am trying to sent a Rest API Call via PowerShell Invoke-RestMethod Cmdlet but I keep getting BAD REQUEST 400 response: RESPONSE Object status_code: 400 message: "Invalid document list" I need to make this request using PowerShell because it would…
Andy Deegee
  • 21
  • 1
  • 5
0
votes
0 answers

407 proxy authentication required for powershell invoke-restmethod

I'm setting proxy, then making a POST API call to Azure resource using powershell invoke-restmethod command. Sometimes I'm getting the following error: The remote server returned an error: (407) Proxy Authentication Required. I tried different…
0
votes
0 answers

Powershell giving error for invoke rest method but works in powershell

I have been working on a script that essentially creates a user using an API. It takes a list of active directory users and creates account on the second software using the API using invoke method. Now the problem is that it will go through for some…
0
votes
0 answers

Invoke-RestMethod 'StatusCodeVariable' scope

I have a .psm1 file that serves as a class with a number of methods for different REST requests. For the methods handling the REST requests, I am using splatting to pass in the 'Invoke-RestRequest' parameters. I am not able to access the…
0
votes
1 answer

SonarQube - Set tags via REST API - Powershell - Invoke-RestMethod

I'm attempting to set tags via the SonarQube REST API, however, the REST API doesn't come with a lot of examples for different scenarios. In my case I'm attempting to set the tags for a given projectKey with an API Key. I want to use…
1 2 3
8 9