Once the VXG Server is connected to VXG Cloud, you can access Server API remotely to manage cameras, get live video, etc.
The Server-Cloud connection is established through the channel with a temporary endpoint that expires in a few hours. To be able to work with the Server API remotely, you need to request the endpoint address.
1. Request information for all servers connected to your cloud account:
curl https://web.vxgdemo.vxgdemo.cloud-vms.com/api/v6/servers/ -H "Authorization: LKey <LIC_KEY>"
or for a particular server:
curl https://web.vxgdemo.vxgdemo.cloud-vms.com/api/v6/servers/<SERVER_ID>/ -H "Authorization: LKey <LIC_KEY>"
Example of the response:
{"api_endpoint": "https://web-7.inst.auth2.cloud-svcp.com:9004/backchannel/bchan.eyJiY2UiOiAzNTJ9.1639523988.vFDqPE7RhEOpyz9ceKJ2YznBbEI/",
"endpoint": "https://web-7.inst.auth2.cloud-svcp.com:9002/backchannel/bchan.eyJiY2UiOiAzNTJ9.1639523988.vFDqPE7RhEOpyz9ceKJ2YznBbEI/",
"expires": "2021-12-14T23:19:48",
"id": 352,
"l_key": "srv.vUEtmR3UsvU4",
"name": "",
"online": true,
"token": "bchan.eyJiY2UiOiAzNTJ9.1639523988.vFDqPE7RhEOpyz9ceKJ2YznBbEI",
"uuid": "EC24DFC5-F320-BCF8-7D1C-72BE8D15A3F9",
"version": "1.6.9.20201210"}
2. Now you just need to use the “api_endpoint” from the response for any Server API request, for example, to create a channel:
curl -X POST "https://web-7.inst.auth2.cloud-svcp.com:9004/backchannel/bchan.eyJiY2UiOiAzNTJ9.1639523988.vFDqPE7RhEOpyz9ceKJ2YznBbEI/api/v3/channels/" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: LKey srv.vUEtmR3UsvU4" -d "{ \"name\": \"Test channel\", \"rec_mode\": \"on\", \"source\": { \"url\": \"rtsp://rtsp.stream/pattern\" }}"