I am trying to send data to Thingtia.cloud.(an implementation of the Sentilo platform) https://sentilo.readthedocs.io/en/latest/
The platform operators are the HTTP protocol methods.
In general, the operation associated with the operations used by Sentilo are:
GET: Request information.
POST: Send new data.
PUT: Update existing data.
DELETE: Erase data.
To update the value of a sensor you need to send a PUT request
In B4A it works correctly...
Enviar datos a Thingtia(PutString):
Sub enviardatosThingtia
'TEST
Dim datos As String
'Formato Json=> {"observations":[{ "value":"35"}]}
datos="{"&Chr(34)&"observations"&Chr(34)&":[{"&Chr(34)&"value"&Chr(34)&":"&Chr(34)&luminosidad&Chr(34)&"}]}"
jobSentilo.Initialize("JobPutThingtia", Me)'inicializar objeto conexión Server
jobSentilo.[B]PutString[/B]("http://api.thingtia.cloud/data/<usuario>/light/", datos)
jobSentilo.GetRequest.SetHeader("IDENTITY_KEY","[B]4d8999174................[/B]")
jobSentilo.GetRequest.SetContentType("application/json")
End Sub
How to implement the PUT request in B4R? HttpJob only implements POST
Sending the data through the POST request does not work. This is only useful if you are going to add new data, not to update