Questions tagged [invoke-restmethod]
129 questions
0
votes
1 answer
Cannot catch "proxy block page" error with Invoke-RestMethod / Try Catch ignored
I am utilising Azure Instance Metadata Service API. This will only work on an Azure VM, which is fine, but I want some error handling. The trouble is that when I run this on my development laptop (heavily locked down environment), I get our…

woter324
- 2,608
- 5
- 27
- 47
0
votes
1 answer
Curl Command to Powershell 5 with XML
I have poked around a bit and I have found good information, but nothing really well on how to handle custom xml data. The code below is what I have done so far in powershell. I know there is an invoke-restmethod but I am struggling to convert this…

David
- 891
- 1
- 8
- 18
0
votes
1 answer
How to capture output value of API request with PowerShell
I am currently doing some basic API REST test with powershell.
However, I am having an issue with capturing a specific output data
For example:
$bearer = Invoke-RestMethod -Method POST -Body $body -uri…

Keno Gabriel
- 19
- 2
0
votes
1 answer
Powershell - Getting values from JSON array return for specific row
Apologies for having to ask a question like this, self taught powershell user here. Having an issue where I cannot seem to get the value I am after from a JSON return on a GET Invoke-RestMethod.
I am trying to pull JIRA ticket data so I can check…

Andy Finch
- 5
- 2
0
votes
1 answer
Invoke-RestMethod from multiple URLs from text file
Need help with PowerShell script with Invoke-RestMethod through several links from text file:
What I have not and works for single site:
$username = 'username'
$password = 'password'
$accept = 'application/xml'
$uri =…

user3360847
- 67
- 1
- 7
0
votes
1 answer
invoke-restmethod keeps giving errors
My powershell invoke-restmethod keeps giving the error: (415) Unsupported Media Type
This is my script:
add-type -AssemblyName System.Net.Http
$url =…

Martijnsp1991
- 15
- 1
- 5
-1
votes
1 answer
Json Array in Powershell from Podto Powershell
I have the following Json in the body of a Postman. what would be equivalent code in Powershell to send rest API via invoke-webrequest or via invoke-restmethod?
Postman Body:
{
"extra_vars": {
"servername": "apicall1234",
…

everydaylearner
- 3
- 2
-2
votes
1 answer
Call API inside powershell function
How to call API inside function. this is my url https://www.gov.uk/bank-holidays.json. I am new for powershell can you help me to do this.
function Holiday {
$list = Invoke-RestMethod -Method Get -Uri https://www.gov.uk/bank-holidays.json
…

AFFISH MOHAMMAD
- 45
- 1
- 6