Questions tagged [invoke-restmethod]
129 questions
0
votes
1 answer
Manage credentials for Invoke-RestMethod request
I'm writing a PowerShell script to query an application API (Qualys), and the first step is to authenticate. I can only do it unsecurely:
[string]$username = "username"
[string]$password = "superpassword"
$hdrs=…

Chips274567
- 3
- 3
0
votes
1 answer
Run Do loop Until API returns all pages of data
I am trying to find a better solution to run the Do loop, Until all contacts are Collected.
Currently I have over estimated the amount of pages to just go until 20 pages. Is there a better method.
I tried $responseheader.HAS_MORE_RECORDS…

Danimal
- 11
- 1
0
votes
0 answers
-FollowRelLink not availalble in powershell 5.1
I am trying to get a list of users from invoke-restmethod but there is a limit of 100 users so only 100 of them come back.I researched a little bit and found out that a -followrellink parameter can be used with the invoke-restmethod but this…
0
votes
0 answers
Invoke web request throwing an error : Invoke-WebRequest : {"errors":[]}
I am using a powershell script to get details from a website via invoke-webrequest. By using the credentials i have connecting to the website using invoke-restmethod to get the token.
After getting the token i used the token to retrieve the details…

Developer____
- 5
- 4
0
votes
1 answer
How do I Authenticate to AAD using Invoke-RestMethod with ClientCredential flow using certfiicate and get the token?
How do I Authenticate to AAD using Invoke-RestMethod with ClientCredential flow using certificate and get the token?
I tried to search for it but no success.
I can authenticate with client Secret but I want to use cert for security purposes.

Moin MD
- 3
- 2
0
votes
0 answers
Convert a Curl Command to PowerShell web request
I am trying to use an invoke-webrequest or invoke-RestMethod for a curl command but can't quite get it right. The curl command that functions is:
curl.exe -X GET -H "Content-Type: application/json" --user 'blahblah:blahblah'…

TankCR
- 61
- 1
- 7
0
votes
1 answer
Invoke-WebRequest and Invoke-RestMethod Not Returning Values in System.Object[]
I'm hitting an endpoint with this data:
{
"Id": "variableset-Projects-922",
"Variables": [
{
"Id": "30bf54b6-2e07-100f-d9f4-26879b3e9462",
"Name": "test",
"Value": "blah blah",
"Description": null,
"Scope": {},
…

cb32
- 1
- 1
0
votes
1 answer
Serialize REST response in powershell
I'm connecting to a REST service
$response = Invoke-RestMethod -Uri $URL -Headers $headers -Method POST -Body $body_json -ContentType "application/json"
$response.Outputs
and I get a response in that format
Actual: {
…

Maurip00
- 39
- 4
0
votes
0 answers
Long running invoke request no response
I have a long-running post request to a rest endpoint which might take a few minutes to finish and I need the response from it to start another
I have tried using Invoke-RestMethod and Invoke-WebRequest but both seem to not be able to track the…

et3rnal
- 322
- 4
- 17
0
votes
1 answer
How to format JSON Output into a Grid for Format-Table in PowerShell
The following code is display the data I want, but it's not aligned nicely.
How can I use a data-grid or format-table to align the data?
$response = Invoke-RestMethod @params
foreach ( $row in $response )
{
Write-host "id=$($row.uuid)…

NealWalters
- 17,197
- 42
- 141
- 251
0
votes
1 answer
Invoke-RestMethod to acces Joe SandBox API
I'm trying to create a powershell script to access JoeSandBox API to download reports.
I'm following their API details there https://www.joesandbox.com/userguide?sphinxurl=usage/webapi.html
Here's the beginning of the REST script I've put…

Martin Forand
- 1
- 1
0
votes
1 answer
converting Get Thumbnail API to base64 with PowerShell (from Microsoft Computer Vision Get Thumbnail API)
I am trying to get an thumbnail image from the Microsoft Computer Vision Get Thumbnail API and save the response as a base64 encoded string that can be used in an html img tag like so:
If I…

Key Va
- 13
- 3
0
votes
0 answers
Extract data from API (odata) into file (csv or json) - Powershell
I am new here, I have to extract data from api web (odata I think) into a file (I don't manage the api data source)
I try to extract with the following code
Invoke-RestMethode -Uri https://myapi.com/api/listofservers -UseDefaultCredentials -…

nboche
- 1
0
votes
1 answer
Invoke-RestMethod is taking longer time to get response from Rest API
I have an API http://xx.yy.zz.aaa:8080/api/2.0/GetVersion which I need to hit from Powershell script. When I try hitting it using Invoke-RestMethod it gives me response in 10 minutes.
When I hit same API using Invoke-WebRequest I get response in…

CK__
- 1,252
- 1
- 11
- 25
0
votes
1 answer
definition inside a property in invoke-restmethod (JSON Body)
I'm pretty stuck and can't find anything about it on the internet. I'm also not sure how to describe the thing i'm looking for, so maybe someone can help me.
I've got some code to create a ticket in TopDesk through API using invoke-restmethod in…

Damian Eickhoff
- 23
- 6