Public Sub TESTGetURLWithParmeters
Dim Link As String = "http://192.168.2.60/rpc/Input.SetConfig"
Dim Parameters() As String = Array As String ("id", 0, "config", $"{"name":"Input0"}"$)
Wait For (GetURLWithParmeters(Link, Parameters)) Complete (DataResult As String)
Log(DataResult)
Dim Link As String = "http://192.168.2.60/rpc/Switch.Set"
Dim Parameters() As String = Array As String ("id", 0, "on", "false")
Wait For (GetURLWithParmeters(Link, Parameters)) Complete (DataResult As String)
Log(DataResult)
Dim Link As String = "http://192.168.2.60/relay/0"
Dim Parameters() As String = Array As String ("turn", "toggle")
Wait For (GetURLWithParmeters(Link, Parameters)) Complete (DataResult As String)
Log(DataResult)
End Sub
'Get With parameter
Public Sub GetURLWithParmeters(Link As String, Parameters() As String) As ResumableSub
Dim Result As String
Dim j As HttpJob
Try
j.Initialize("", Me)
j.Download2(Link, Parameters)
j.GetRequest.SetHeader("Content-Type","application/json")
j.GetRequest.Timeout = 60000
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Result = j.GetString
End If
Catch
Log(LastException)
End Try
j.Release
Return Result
End Sub