rest - Powershell Invoke-RestMethod POST Method timeout issue -
i'm trying write program deletes files specific device. device has rest api , can access cli without problems.
for example if write in cli, works :
$clip="test.mov" $clipsurl="http://123.45.67.89/clips" $cliptodelete=@{action="delete";clipname=$clip} invoke-restmethod -uri $clipsurl -body $cliptodelete -method post -contenttype "application/x-www-form-urlencoded"
i can play around $cliptodelete parameter (changing value of $clip) , works every time.
now when put in loop (in main script) works first time, , times out next.
foreach($clip in $listclips) { $clip="test.mov" $clipsurl="http://123.45.67.89/clips" $cliptodelete=@{action="delete";clipname=$clip} invoke-restmethod -uri $clipsurl -body $cliptodelete -method post -contenttype "application/x-www-form-urlencoded" }
while debuging can see values passed parameters invoke-restmethod correct (the url & body correct).
my first impression should close session (if makes sense) before trying post again.
i tried adding sessionvariable
parameter command didnt change thing
does know how close web sesion left open (with new invoke-restmethod command) ? or think issue lies elsewhere ?
thank you.
i had faced similar issues while invoking rest apis airwatch. evidently bug has been filed post & delete methods below:
but did face issue intermittently requests too, documented workarounds had use in below technet wiki article, maybe can try , improve if find :
Comments
Post a Comment