156 questions
0
votes
2
answers
107
views
PowerShell odd behavior with Invoke-RestMethod Object returned from VirusTotal API
I am following the directions according to https://docs.virustotal.com/reference/url-info
And I successfully get a response from VirusTotal API when I:
$id="u-...
0
votes
1
answer
71
views
Add a value for sprint in an existing JIRA ticket using invoke-restmethod
I would like to add a sprint value (or name or string or id) in an existing JIRA ticket via Powershell and more specifically invoke-restmethod (not with curl).
Could somebody mention me an existing ...
1
vote
1
answer
142
views
Azure Automation, doing a GET from Invoke-WebRequest using Powershell 7.2 returns a bad request 400 error
Odd problem in Azure Automation, this code block doing a GET will work in 5.1, but not 7.2. However, if I do a POST or UPDATE, in 7.2 it works fine. I've done some research and I can't find any ...
0
votes
1
answer
101
views
Issue when trying to attach a txt file in a JIRA ticket using Invoke-RestMethod in Powershell
I would like to attach a small txt file in an existing JIRA ticket by the help of the command Invoke-RestMethod - POST in Powershell
Here after the code (file Test_JTR_post_transition.ps1):
param(
[...
1
vote
1
answer
196
views
Handling Nested JSON returned from Invoke-RestMethod
I'm trying pull data from WhatConverts via their API, and to then upload that into a SQL table. As I've dug deeper into the nature of the underlying data, there are several data types being returned ...
0
votes
1
answer
268
views
M365 Graph API script Error 404 when running but works fine when debugging
I'm running into an issue with a powershell script using Microsoft Graph API commands to create user accounts in M365.
It's strange because it wasn't having any issues until fairly recent. Basically, ...
0
votes
0
answers
43
views
why does the request work if I'm using Invoke-RestMethod but it doesn't if I'm using requests from python?
The Invoke-RestMethod looks like:
Invoke-RestMethod -Uri 'url' -Method 'GET' -Headers $headers
The header contains a bearer token
The python code looks like:
import requests
url = "some_url&...
0
votes
0
answers
41
views
For which status codes is Invoke-RestMethod throwing exceptions?
I'm building a PowerShell script and I want to master my fallback strategy using Invoke-RestMethod according to returned HTTP Status Codes.
I'm assuming that Invoke-RestMethod throws for any non 2XX ...
1
vote
1
answer
133
views
Powershell: How to process Result when the Result changes with every query?
I send a POST command against an API with Invoke-RestMethod. I expect the return value to be a download link that I want to process further. However, this URL is stored in a property whose name ...
0
votes
1
answer
154
views
PowerShell Invoke-RestMethod gives an error after password change
I have a PowerShell script for calling an API. Currently it looks like this:
param( [string]$resultFile, [string]$from, [string]$to)
try {
$headers = @{'api-key' = '763bcb3d-7b62-4075-877e-...
0
votes
1
answer
52
views
Unable to Trigger Invoke Rest Method using variable in Powershell
I am trying to invoke 2 rest method and executing the 2nd one in loop as shown in below code.
$resultIdRes = (Invoke-RestMethod -Uri "https://neoload-api.saas.neotys.com/v3/workspaces/tests/...
1
vote
1
answer
365
views
Update DevOps variable group via Pipeline PowerShell script with values from SQL DB
I am attempting to automate the updating of a variable group in Azure DevOps using a PowerShell script executed within a Pipeline. The goal is to retrieve values from a SQL database and dynamically ...
0
votes
0
answers
154
views
Invoke Rest API with a custom header
I am trying to invoke a rest api. But I get 401 unauthorized. The same call works fine from C# and postman with the same token.
Here is a snippet of the code I am using:
$contentType = "...
-1
votes
1
answer
48
views
Can anyone help me with a PS script.?
...it's connecting to the Emsisoft API (https://api.emsisoft.com/) to create a workspace, but I need help understanding the error.
# Define your API endpoint URL
$apiUrl = "https://api.emsisoft....
0
votes
1
answer
496
views
JSON Body query on Invoke-RestMethod Powershell method for Power BI Refresh
i'm currently developing a Powershell script to refresh a single table partition of my Power BI dataset using a POST API call through the Invoke-RestMethod.
# Connect the Service Principal
$password = ...
0
votes
1
answer
171
views
Powershell | API PUT METHOD
I'm trying to figure out why my script not working anymore:
$Header = @{
'user' = "myuser"
'password' = "mypassword"
}
Invoke-...
0
votes
1
answer
2k
views
Powershell Invoke-Restmethod w/ JSON Body
Hope someone can help.
I'm trying to send a REST POST message using the Invoke-Rest method command to a sms service. When I use postman to send the request I'm able to send the message. However, when ...
0
votes
0
answers
340
views
Powershell - Using Invoke-RestMethod, unable to extract "Status" data
I'm a newbie when it comes to using soap and rest, so don't assume I know what I'm doing. I've been doing some google searching and have confused myself more that I've helped.
I'm unable to extract ...
1
vote
1
answer
1k
views
Encoding problem when generating user in Microsoft Graph
What character encoding should a POST body to /v1.0/users have?
I have problems with generating users with accented characters in the name with Microsoft Graph.
I use the following body:
{
"...
1
vote
2
answers
519
views
find the type of file from API response - PowerShell
I have this code to download the file and save it but I don't know the type of the file so when saving it I am having trouble deciding the type.
here is the code
$tokenUrl = "/api/v1/gettoken&...
0
votes
0
answers
223
views
Powershell Invoke-Restmethod Authorization header issue
I am trying to query the endpoint for target failures in zendesk:
https://developer.zendesk.com/api-reference/ticketing/targets/target_failures/
Specifically:
List Target Failures
GET /api/v2/...
1
vote
2
answers
336
views
How to Get Unicode data from Azure Devops Git Repository Get Item Rest Api?
I prepared following request to get a file content from azure devops reop item api. the file content stored in git in UTF-8 format. but the output of rest api is not as expected! how to fix the issue ...
0
votes
1
answer
751
views
PowerShell - Issues Downloading Base64-Encoded PDF (Blank/White PDF)
Overview:
I am trying to make a script that downloads my internet service provider's (ISP) monthly statement. 'Cus, you know, who doesn't do that regularly? My ISP is Spectrum. I have the code that ...
0
votes
1
answer
402
views
Invoke-RestMethod (GET) : The remote server returned an error: (403) Forbidden PowerShell but some work with CMD Curl
The same Error happened with the 'get' method in the PowerShell command Invoke-RestMethod. I'm wondering if someone can help me with the following error (hide some information):
PS C:\Windows\...
0
votes
0
answers
169
views
List all ODATA.NEXTLINK without getting values
Anybody have an idea how in powershell we could list all @ODATA.NEXTLINK without crawling the values.
We have 130k users and using the paging of invoke-restmethod on https://graph.microsoft.com/v1.0/...
0
votes
1
answer
683
views
Azure Automation PowerShell read CSV file from SharePoint
Add the moment I am able to read files from our SharePoint with Azure Automation.
The problem for me is when I do the import I loss all the property values on the CSV.
So the following file has the ...
0
votes
1
answer
228
views
Powershell Invoke-RestMethod on Graph API returns code 400 on uri graph.microsoft.com/v1.0/me/sendMail
Im having big troubles understanding, why my Powershell Code always returns code 400 on Invoke-RestMethod
This is my sample code
#leaving out clientid and tenantid intentionally
$MsalParams = @{
...
0
votes
1
answer
330
views
How to use Invoke-RestMethod with Import-Csv to loop through URLs
I'm attempting to dynamically create about 50 QR Codes using GoQR.me's API. I have all the source and destination URLs in a CSV file QRCodes.csv formatted as:
source, destination
https://api.qrservers....
0
votes
1
answer
224
views
PowerShell Invoke_RestMethod passing variables inside single quotes
I am using powershell to get data using INCOKE-RestMethod and using GET method
So far i did this on PowerShell
$response = Invoke-RestMethod 'www.sample.net/data?key=1234&Accept=application/JSON&...
0
votes
0
answers
149
views
Define the specific one of 3 download file with redirect & "click here"
**How can i Download this File ?no matter how **
I am not looking for a bug in my code or the possibility to use a specific variant. = Im now Open for everything :D
MainSitehttps://www.lcpdfr.com/...
0
votes
0
answers
863
views
PowerShell Error: Invoke-RestMethod: Unable to connect to the remote server
I'm running the following script to retrieve the credentials of a service account from conjur (cyberark product)
# Create a dictionary to store headers
$headers = New-Object "System....
0
votes
0
answers
72
views
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":&...
1
vote
2
answers
527
views
Python call Powershell Invoke-RestMethod with Json as string into Body
import requests
import subprocess
import base64
credentials = "login:password"
url = f'urlXXXurl'
body = '{"id": 4986986, "key": "2df534ee-270b-4ab4-83fb-...
0
votes
1
answer
255
views
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 ...
0
votes
2
answers
2k
views
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 (...
1
vote
0
answers
597
views
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 = "<my_access_token>"
$projectId = "5"
$file = "...
0
votes
0
answers
1k
views
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.
# ...
0
votes
1
answer
639
views
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 ...
1
vote
0
answers
110
views
Invoke-RestMethod works on cable but not on Wifi
When connected on Wifi:
PS C:\Users\Julio> Invoke-RestMethod juliobs.com
Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a receive.
At line:1 char:1
+ ...
0
votes
1
answer
489
views
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 -...
0
votes
0
answers
439
views
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 ...
2
votes
2
answers
4k
views
Invoke-RestMethod (or Invoke-WebRequest) returning string rather than PS object or JSON
I'm relatively new to using Invoke-RestMethod /Invoke-WebRequest in general- I think that's important context for the below question.
I'm making a call like the below:
$Headers = @{
"...
0
votes
1
answer
615
views
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 ...
1
vote
1
answer
942
views
Download a file from REST API and upload to Sharepoint without need for intermediate storage
My first post here, as I am newb to scripting/programming.
I have a requirement to download files from an external service via a REST API and then upload those files to SharePoint. I have put together ...
0
votes
1
answer
3k
views
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 = [...
0
votes
0
answers
137
views
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 ...
1
vote
1
answer
1k
views
InvalidOperation in PowerShell RestMethod API Call using Bearer sending Body as HASHTABLE
In PowerShell using Invoke-RestMetjhod to call different API´s I am stuck getting an InvalidOperation error when trying to pass both header and body information to the POST call.
My script is:
Set-...
0
votes
1
answer
875
views
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 ...
0
votes
1
answer
319
views
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-...
1
vote
1
answer
705
views
Powershell Invoke-RestMethod - Formatting response for .csv Export
I'm writing a script to pull order details from an API using Invoke-RestMethod.
I have the response which PS has converted json into a PSCustomObject.
What I'm attempting to do is produce rows in a ....