Imports System.Reflection Imports Chilkat Public Class cPascom Dim API_USER_AUTHORIZATION = "bW9ieTpnWlhTSVprTnhmaUQxOEU=" Property Arbeitsplatz As String = "" Property Username As String = "" Public Function Anmelden() As Boolean If Arbeitsplatz.Length > 0 And Username.Length > 0 Then Try 'Benutzername: moby 'Passwort: XgDsFmMSutaMLA1 'BASIC Auth String: bW9ieTpYZ0RzRm1NU3V0YU1MQTE = cChilkat_Helper.UnlockCilkat() Dim API_STRING = "pbx3.flashnet.at" Dim rest As New Chilkat.Rest Dim success As Boolean Dim bTls As Boolean = True Dim port As Integer = 443 Dim bAutoReconnect As Boolean = True success = rest.Connect(API_STRING, port, bTls, bAutoReconnect) If (success <> True) Then Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason) Debug.WriteLine(rest.LastErrorText) Return False End If rest.AddHeader("Content-Type", "application/json") rest.SetAuthBasic("moby", "XgDsFmMSutaMLA1") Dim json As New Chilkat.JsonObject Dim successJsonLoad As Boolean = json.Load(" {""action"":""relocate"",""username"":""" & Username & """}}") If (successJsonLoad <> True) Then MsgBox(json.LastErrorText) Return False End If Dim sbRequestBody As New Chilkat.StringBuilder json.EmitSb(sbRequestBody) ' MsgBox(sbRequestBody.ToString) Dim sbResponseBody As New Chilkat.StringBuilder success = rest.FullRequestSb("POST", "/verag/services/location/" & Arbeitsplatz, sbRequestBody, sbResponseBody) If (success <> True) Then Debug.WriteLine(rest.LastErrorText) Return False End If Dim respStatusCode As Integer = rest.ResponseStatusCode If (respStatusCode <> 202) Then ' MsgBox(sbResponseBody.GetAsString()) Return False End If Dim jsonResp = New Chilkat.JsonObject() jsonResp.LoadSb(sbResponseBody) Dim gatewayId = jsonResp.StringOf("gatewayId") Dim Resp_error = jsonResp.StringOf("error") Dim Resp_errorCode = jsonResp.StringOf("errorCode") Return True Catch ex As Exception Return False End Try Return True Else Return False End If End Function 'Public Function GetTelArbeitsplatz4Host() As Boolean ' Try ' Dim lines = IO.File.ReadAllLines("\\dc01.verag.ost.dmn\NETLOGON\Telefonarbeitsplaetze.ini") ' Dim colCount = lines.First.Split(";"c).Length ' For Each line In lines ' Dim objFields = From field In line.Split(";"c) ' If String.Compare(cRes.LocalUser.Hostname, objFields(0).ToString, True) = 0 Then ' Arbeitsplatz = objFields(1).ToString ' '_ConString = objFields(2).ToString ' Return True ' Exit Function ' End If ' ' End Select ' Next ' Return False ' Catch ex As Exception ' ' MsgBox("Fehler beim Lesen TSAnmeldung.ini: " & vbCrLf & ex.Message) ' End Try 'End Function End Class