' refresh and access token are succefull received in code before.
' strToken contains the access token.
If strToken <> "" Then
' Set APIurl
strAPIurl = "https://xxxxxx.yyyyyy.zz/api/registrations/"
' Set Payload arguments
' Don't do this...
' strPayload = "{"
' strPayload = strPayload & Chr(34) & "ip_address" & Chr(34) & ":" & Chr(34) & strIPAdres & Chr(34) & ","
' strPayload = strPayload & Chr(34) & "license" & Chr(34) & ":" & Chr(34) & strLicense & Chr(34) & ","
' strPayload = strPayload & Chr(34) & "b_code" & Chr(34) & ":" & Chr(34) & strBcode & Chr(34) & ","
' strPayload = strPayload & Chr(34) & "serial_no" & Chr(34) & ":" & Chr(34) & "4657818514G5161ESS" & Chr(34) & ","
' strPayload = strPayload & Chr(34) & "message" & Chr(34) & ":" & Chr(34) & "Setup succesfull" & Chr(34) & ""
' strPayload = strPayload & "}"
'
' ...do that (using smart string literals)
Dim strPayload As String = $"{'ip_address':'${strIPAdres}','license':'${strLicense}','b_code':'${strBCode}','serial_no':'4657818514G5161ESS','message':'Setup succesfull'}"$
' log each part
Log("Access token = " & strToken)
Log("APIurl = " & strAPIurl)
Log("Payload = " & strPayload)
' Post it to the API server
j.Initialize("", Me)
J.PostString(strAPIurl,strPayload)
J.GetRequest.SetContentType("application/json")
J.GetRequest.SetHeader("Authorization","Bearer " & strToken)
Wait For (J) JobDone(j As HttpJob)
If J.Success Then
Log(J.GetString)
End If
j.Release
End If