Questions tagged [invoke-restmethod]

129 questions
1
vote
1 answer

PowerShell Invoke-RestMethod skips a returned null value when navigating through the array values. Ideas?

I am calling an API that returns 3 values in an object "tags", which has values for "tags.name" and tags.results". The values below are what is returned. But as I try to navigate through the values, I can see that the "null" value, the {}, was not…
1
vote
1 answer

Invoke-RestMethod with JSON body

I'm trying to write a powershell script (powershell 6 and 7) to make REST call API from a text file with JSON body. Here's my code: $uri = 'URI' $json = Get-Content 'TXT_FILE_WITH_JSON_BODY' | Out-String | ConvertFrom-Json | ConvertTo-Json |…
Brice
  • 67
  • 2
  • 13
1
vote
1 answer

Databricks Jobs REST API call does not work with Powershell

So, here is the link to Jobs API call in Databricks here Everything works in Python using requests. E.g both the job creation and job listing works import requests proxy= "http://127.0.0.1:8888" access_token="tokenabc" proxies = { "https":…
Saugat Mukherjee
  • 778
  • 8
  • 32
1
vote
1 answer

How to connect 2 expandproperty data with eachother

In my script I use an expandproperty 3 times, this to get to the correct data. In the first expand property I also have to use data. But I cannot add this to the select line. In -expandproperty value I have to use computerbalance and in…
Martijnsp1991
  • 15
  • 1
  • 5
1
vote
1 answer

REST API from PowerShell - "POST Method not allowed"

I am trying to upload one file to BitBucket repository (Git system). I am trying to send that using the REST API but the error Indicates that POST method is not allowed, although I can of course using the "git push" command to send new files. But if…
vel
  • 1,000
  • 1
  • 13
  • 35
1
vote
1 answer

How do I POST from Powershell using Invoke-RestMethod

As per https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7#example-2--run-a-post-request I am trying to invoke a simple POST method but getting some errors. My instruction is: $uri =…
Robert Green MBA
  • 1,834
  • 1
  • 22
  • 45
1
vote
1 answer

How to reimplement the SessionVariable/WebSession variable concept of Invoke-RestMethod in PowerShell?

I want to wrap several Invoke-RestMethod calls by two functions and I have to pass the WebSession variable between them. Goal: Login -SessionVariable MySession # do some work while using $MySession Logout -WebSession $MySession The Login and Logout…
stackprotector
  • 10,498
  • 4
  • 35
  • 64
1
vote
1 answer

Querying an API which is returning failed, formatting error somewhere

I'm trying to query this API https://docs.iocparser.com/api-reference/parse-api I'm getting a failure to resolve URL error, which makes me believe that somewhere in this line I've gone wrong with the formatting, but I can't figure out where, so any…
user9130768
1
vote
2 answers

Convert Curl to Invoke-RestMethod

Problem I am having a hard time converting a curl call into a Powershell Invoke-RestMethod call as Powershell doesn't really thow the most informative error messages (if any). Curl call (Ubuntu) token = "djsakldsakldjaslda" host =…
Esben Eickhardt
  • 3,183
  • 2
  • 35
  • 56
0
votes
0 answers

The remote server returned an error: (400) Bad Request on invoke-restmethod using powershell on using OAUTH2 to upload file in google drive

I am trying to upload JSON file in google drive using Powershell. I have generated an OAUTH credentials to connect to google drive and using this credentials to upload JSON file in the google drive but I am receiving an 400 Bad Request error at…
0
votes
0 answers

HTTP POST request to API

I'm encountering an error while making an API call using PowerShell. The error message I receive is: Error calling the API: "errorTypeCode":"REQUEST-EMPTY","message":"Supply valid JSON-object when posting.".Exception.Message" This issue occurs…
0
votes
1 answer

Powershell 5.1, howto send nls (åäöü etc) in json using Invoke-RestMethod

I have a script that sends text (names) to a REST api. I read the names (and other info) from the AD and construct a JSON string and then use Invoke-RestMethod to send the data to the external REST API. They tell med I should send the data in ISO…
jmase
  • 1
  • 1
0
votes
2 answers

Retrieve App Owners from Azure Portal App Registration using Microsoft Graph API and REST Method

I am trying to retrieve app owners from Azure Portal App Registration under the Manifest using the Microsoft Graph API and REST Method via a PowerShell script. I am using a service principal account (client secret key), tenant, and client ID (app…
0
votes
0 answers

Upload an image to Gitlab using the API with powershell

I'm trying to load an image (.png) into my Gitlab project using an API call from powershell but it doesn't work $token = "" $projectId = "5" $file = "path\test.png" $apiUrl =…
0
votes
0 answers

Sending a HTTPS-Request with Client Certificate from Azure Function to external Webserver

I am starting to get a little bit desperate. When sending an HTTPS-Request from my local machine using the following code, everything works fine and I get my expected response from the webserver. # Get the certificate as secret (includes public and…
1 2 3
8 9