HttpWebRequest.Create in Invoke Code

Hi!

I’m stuck with creating a Web Request in Invoke Code activity. I found this topic on the forum, but I can’t import System.Web.Script.Serialization there is only System.Web

Dim myReq As HttpWebRequest
Dim myResp As HttpWebResponse

myReq = HttpWebRequest.Create(in_URL)

myReq.Method = "GET"
myReq.Headers.add("Content-Type", "application/json")

myResp = myReq.GetResponse
Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
Dim myText As String
myText = myreader.ReadToEnd
console.WriteLine("myText: " + myText)

@Robert_Work

You can directly use with namespace in the code.that should suffice

Cheers

the linked resource is a few years back
from the code we do understand that a get call is performed and a JSON response is expected

Similar we can do with the HTTP Request Activity (as of now available, compared to 2018)

In some case we do prefer to have a custom implementation. But kindly note the following:

taken from:

also have a check on RestSharp

Focussing on this part, we can check details on the MSDN docu for the assembly:

Often it helps to add manually the reference to the assembly inside the XAML (take backup before) when types cannot be resolved via namespace paths

But also the evolution was ongoing and we would use Newtonsoft / System.Text.Json as mentioned on the docu page

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.