Logic Machine Forum
spaceLYnk - LSS100200- API - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: spaceLYnk - LSS100200- API (/showthread.php?tid=5084)



spaceLYnk - LSS100200- API - gabimihalut - 07.11.2023

Hello, I bought and install a spaceLYnk - LSS100200 for the first time. The things is I have some problem with using de API. I am not sure that I find the best solution. Is there anyone here that have used spacelynk (or wiser) as a API server, and can tell me how can I take the json from it ?
In the manual, I saw something like: https://remote:remote@192.168.0.10/scada-remote?m=rss&r=alerts
But with this, the problem is that I need a ssl certificate if i want to take those data from another pc/server.



RE: spaceLYnk - LSS100200- API - Erwin van der Zwart - 07.11.2023

What you referring to is not the API but remote services, that is something else but you can use this also with http (don’t use http from remote / internet without proper VPN as your password will be send unencrypted)

See: https://openrb.com/docs/remote-new.htm


RE: spaceLYnk - LSS100200- API - gabimihalut - 08.11.2023

(07.11.2023, 19:40)Erwin van der Zwart Wrote: What you referring to is not the API but remote services, that is something else but you can use this also with http (don’t use http from remote / internet without proper VPN as your password will be send unencrypted)

See: https://openrb.com/docs/remote-new.htm

Ok, so what is the correct way to take json from this device? I supose you have to connect it to schneider cloud, or something like that. What is the first step? From what can I see, I don't know why, but my device is not connecting to cloud. I don't know what problem it have.

In the manual it does't say nothing about API and credential for it.


RE: spaceLYnk - LSS100200- API - Erwin van der Zwart - 08.11.2023

As I mentioned yesterday in the other topic you created, a spaceLYnk cannot be connected to our cloud at this moment, this is linked to our app that is currently only supported on Wiser for KNX.

You need to use remote services and the link i shared is exactly explaining how it works including the JSON object set you need..

Make sure to enable the function under system -> services -> remote services

Use URL like this: 
Code:
http://remote:Schneider01@192.168.10.200/scada-remote?m=json&r=objects
 
You should get a respons like this:
Code:
[
  {
    "id": 65797,
    "address": "32/1/5",
    "data": 237.1999969482422,
    "datatype": 14,
    "date": "Wed, 08 Nov 2023 08:09:02 +0100",
    "comment": "",
    "name": "Solar - Voltage A-N",
    "time": 1699427342
  },
  {
    "id": 65543,
    "address": "32/0/7",
    "tags": [
      "Werkelijk Verbruik"
    ],
    "data": 0.15,
    "datatype": 9,
    "date": "Wed, 08 Nov 2023 08:08:04 +0100",
    "comment": "",
    "name": "Actueel verbruik",
    "time": 1699427284
  }
]



RE: spaceLYnk - LSS100200- API - gabimihalut - 08.11.2023

(08.11.2023, 06:57)Erwin van der Zwart Wrote: As I mentioned yesterday in the other topic you created, a spaceLYnk cannot be connected to our cloud at this moment, this is linked to our app that is currently only supported on Wiser for KNX.

You need to use remote services and the link i shared is exactly explaining hoe it works including the JSON object set you need..

Understood. But the method you mentioned in that link will work only locally, right?


RE: spaceLYnk - LSS100200- API - Erwin van der Zwart - 08.11.2023

Remote services are also working from remote, but in that scenario you should use HTTPS to have your credentials encrypted.


RE: spaceLYnk - LSS100200- API - gabimihalut - 08.11.2023

(08.11.2023, 07:17)Erwin van der Zwart Wrote: Remote services are also working from remote, but in that scenario you should use HTTPS to have your credentials encrypted.

Yes, I know. The problem is that when I forward the ip, use React.js to acces the api, and make a button to send a true value, in the browser I will receive error :
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource. Because the device doesn't have a ssl certificate. And because I can't connect it to a platform, I can't give it a ssl certificate.


RE: spaceLYnk - LSS100200- API - Erwin van der Zwart - 08.11.2023

I can't change the fact that HTTPS requires certificates, that is how it is designed by the W3C..

In fact, i support this method to be sure your connection is secured when connecting it to the internet and that is hard needed today..

You can upload your SSL certificates in the SL, i can't control what your remote React.js is able to do..

I just did a test, i enabled remote services on my Wiser, forwarded HTTPS to the internet, create a script in another spaceLYnk and that works as intended..
   


RE: spaceLYnk - LSS100200- API - gabimihalut - 08.11.2023

(08.11.2023, 07:48)Erwin van der Zwart Wrote: I can't change the fact that HTTPS requires certificates, that is how it is designed by the W3C..

In fact, i support this method to be sure your connection is secured when connecting it to the internet and that is hard needed today..

You can upload your SSL certificates in the SL, i can't control what your remote React.js is able to do..

I just did a test, i enabled remote services on my Wiser, forwarded HTTPS to the internet, create a script in another spaceLYnk and that works as intended..

Sorry that I ask, but do you have a domain? I have just port forwarded 443 of the ip of my spacelynk.  Here are some screenshot of my code and result on browser


RE: spaceLYnk - LSS100200- API - admin - 08.11.2023

You can set up to 4 allowed CORS hosts in System config > Services > HTTP server. But instead of port forwarding you should look into other solutions like MQTT (you will need a server for that) or a Telegram bot.


RE: spaceLYnk - LSS100200- API - gabimihalut - 08.11.2023

(08.11.2023, 08:49)admin Wrote: You can set up to 4 allowed CORS hosts in System config > Services > HTTP server. But instead of port forwarding you should look into other solutions like MQTT (you will need a server for that) or a Telegram bot.

And what exactly are those CORS hosts and how can I obtain them?


RE: spaceLYnk - LSS100200- API - admin - 08.11.2023

Your request is blocked because it does not pass remote host (CORS) check. You can specify up to 4 IP addresses that are allowed to make such requests but with port forwarding it might not work correctly due to clients having dynamic IPs.