I am currently working on a project where I need to use a web api. I see the invoke-webservice cmdlet in 3.0 but the servers im working on have 2.0 and I cant upgrade them without the customers approval. With that said I am trying to get this to work using the .net way and im having issues adding the body of the request. Below is my code that I have so far and I can add the header and url but when I do a GM on $request I don't see anything for body.
Would anybody know how to add the body? I need to add a json object to the body of the request.
$url = "https://remoteserver:8443/oo/rest/roles" $request = [System.Net.WebRequest]::Create($url) $request.Headers.Add("Authorization","Basic <Account>") $request.Method= "Get" $request.GetResponse()