I'm developing an app to control my Phillips Hue lights. I'm currently using API V1 for this. It is deprecated and will be replaced by API V2. My problem is that I don't know how to use the new GET and POST requests with B4X. Using the old API I got the list of lights with:
B4X:
Dim JobDoc as HttpJob
JobDoc.Initialize("", Me)
JobDoc.Download("https://192.168.178.34/api/" & UserID & "/lights")
Wait For (JobDoc) JobDone(JobDoc as HttpJob)
...
The new API requires authentication in the request header. The migration instructions say: The combination of the new endpoint with the new header results in the following equivalent request on V2:
HTML:
curl --insecure -H 'hue-application-key: <appkey (== username)>' -X GET 'https://<ipaddress>/clip/v2/resource/light'
Does anyone know how to handle this with B4X? Thanks in advance.