Hello Friends,
i working on a App with the a (Rest-)API.
First i have to get the Token with an POST:
The Job get the new Token = OK!
But now i have to send a GET with Json and the Token:
In the Docomentation it looks like this:
METHOD: GET
URL: https://192.168.178.41:8443/group/set?idx=1&onoff=1
HEADER: { “Content-Type“ : “application/json“;
“authorization“: " 1234567890 "}
My Code:
do not work! -> Error: Method Not Allowed
How do i code a correct GET with a Header incl. Content-Type an Authorization....?
Thanks for your HELP!
Greetings Tom
i working on a App with the a (Rest-)API.
First i have to get the Token with an POST:
B4X:
Sub Hole_Token
job1.Initialize("Job1", Me)
Dim objMap As Map: objMap.Initialize
objMap.Put("password","123")
objMap.Put("serialNumber","1234567890")
objMap.Put("username","abc")
Dim objJSon As JSONGenerator: objJSon.Initialize(objMap)
Log(objJSon.ToPrettyString(2))
job1.PostString("https://192.168.178.41:8443/session", objJSon.ToPrettyString(2))
End Sub
The Job get the new Token = OK!
But now i have to send a GET with Json and the Token:
In the Docomentation it looks like this:
METHOD: GET
URL: https://192.168.178.41:8443/group/set?idx=1&onoff=1
HEADER: { “Content-Type“ : “application/json“;
“authorization“: " 1234567890 "}
My Code:
B4X:
Sub Group1
job2.Initialize("Job2", Me)
Dim objMap As Map: objMap.Initialize
objMap.Put("Content-Type","application/json")
objMap.Put("Authorization",Token_String)
Dim objJSon As JSONGenerator: objJSon.Initialize(objMap)
Log(objJSon.ToPrettyString(2))
job2.PostString("https://192.168.178.41:8443/group/set?idx=1&onoff=1", objJSon.ToPrettyString(2))
End Sub
do not work! -> Error: Method Not Allowed
How do i code a correct GET with a Header incl. Content-Type an Authorization....?
Thanks for your HELP!
Greetings Tom