Sending API Calls to a System via Nx Cloud
Sending Generic Events/API Calls to an Nx Witness System via Nx Cloud is both possible and pretty straightforward.
Every API call (like an HTTP Generic Event) has a standard structure that begins with https://address:port/api/ - which includes:
- the protocol (http, https)
- domain (IP address + port or domain name)
- and path to api (/api).
When sending an API call on a local or virtual network most often the domain is the IP address (either public or private) of the computer running the Nx Witness Server application followed by port 7001 (the default port when installing Nx Witness).
When sending an API call via Nx Cloud the request will be transferred through the Nx Cloud proxy service (e.g. 3rd Party --> Nx Cloud --> Nx Witness Server) and, as a result, you'll need to:
- modify the URL structure
- include the cloudSystemId
Below we outline how to do that in a bit more detail.
A few things to consider before you begin:
- Only HTTPS calls will work using this method.
- Browser based requests will not work (CORS protection)
- Supports HLS streams but doesn’t support RTSP streams
Step 1: Find your cloudSystemId
There are three different methods to find the cloudSystemId:
Method 1: Find cloudSystemId in a Browser
This is the simplest method.
- Log in to Nx Cloud (https://nxvms.com/systems)
- Select the target System (the System you'd like send API calls to)
- In the browser check the URL - the cloudSystemId is the long string after https://nxvms.comhttps://nxvms.com/systems/
Example:
https://nxvms.comhttps://nxvms.com/systems/397f56fb-4c5c-485e-a923-9bea345fa7ba
397f56fb-4c5c-485e-a923-9bea345fa7ba is the ID you need
Method 2: Find cloudSystemId via a direct API call
Make sure you're logged into the Nx Witness Server Web Admin interface or include
- Send a direct API call to a Server in your System to request moduleInformation
- API format: https://serverIPaddress/api/moduleInformation
- Search through the Json response for cloudSystemId and you should be good to go.
Method 3: Find cloudSystemId via an Nx Cloud API call
- Make a cloud request https://nxvms.com/cdb/system/get using digest
authentication and your Nx Cloud credentials (username, password). - The response will contain a list of all cloud-connected Systems available for the credentials you use. Refer to this article about Nx Witness Authentication APIs
Example Response:
{"systems":[{"id":"397f56fb-4c5c-485e-a923-9bea345fa7ba","name":"example-system" ...
Step 2: Update your API call URL to include the Nx Cloud relay.
- Replace the local IP and port of your original request with
https://{systemId}.relay.vmsproxy.com
Example
Before: http://127.0.0.1:7001/api/createEvent?source=Cloud&caption=Test
After: https://397f56fb-4c5c-485e-a923-9bea345fa7ba.relay.vmsproxy.com/api/createEvent?source=Cloud&caption=Test
Comments
0 comments
Article is closed for comments.