Link to home
Start Free TrialLog in
Avatar of Benny Caspi
Benny CaspiFlag for Israel

asked on

how to use Method PUT in Powershell

In Powershell when I try to run Invoke-WebRequest -Uri http://DMS/admin/apps/478/0.0.2/Android -Method PUT -body $dms2

Invoke-WebRequest : Length Required
HTTP Error 411. The request must be chunked or have a content length.

my mission is to get some parameters in Invoke-WebReques Method Get , replace some variables and update specific line with Method PUT

my script:
$dms2=Invoke-WebRequest -Uri http://DMS/admin/apps/478/0.0.2/Android -Method Get
$dms2.Content.Split(',') | Select-String -Pattern "dictionary_url_rus"
$BB=$dms.tostring().Substring($dms.tostring().LastIndexOF("/") +1).trim('}','"')
$dms2.tostring() -replace $BB, "temp.json"

$dms=Invoke-WebRequest -Uri http://DMS/admin/apps/478/0.0.2/Android -Method PUT -body $dms2
Avatar of Qlemo
Qlemo
Flag of Germany image

Try if POST works instead.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.