Invoke-webRequest help

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Rob Simmers Rob Simmers 3 weeks, 2 days ago.

  • Author
  • #54977
    Profile photo of Aaron K
    Aaron K

    Hi. I am trying to understand Invoke-webRequest and how to submit information properly. Issue: Current site will not allow user authentication and a checkbox needs to be selected to allow advancing to the next page. Using fiddler I have discovered the only difference when clicking the checkbox appears to add one extra value. After Invoke-Webrequest to my $uri variable, I can see that $data.forms.fields has this field and the value set to ON. I then proceed to invoke-webrequest to the same $uri using the following

    $Returndata= Invoke-WebRequest $Uri -Credential $cred -Method Post -Body $data.Forms.fields -ContentType "application/x-www-form-urlencoded"

    My $returnData is always the same as my original data. I am hoping it would return the next page so I can submit the necessary data into the next page that has more form data. Looking for any advice if this can be done.

  • #54980
    Profile photo of Rob Simmers
    Rob Simmers

    I would recommend using a tool built to interface with API's like PostMan, which is a Chrome extension. I'd review the API documentation to see if there are examples on how to do what you're attempting. It really depends on how the API is built to help you with your inquiry.

You must be logged in to reply to this topic.