Get active alarms via RESTful APIs

Hello, what is/are the best RESTful APIs to retrieve the list of active alarms?

We are planning to periodically (e.g. every 10 seconds) poll and retrieve all the new alarms (and perhaps events).

Also, what would be the way to individually acknowledge, set on hold, and close individual alarms?

Thank you.

Currently the Milestone RestAPI supports configuration, the setup of alarm definitions, setup of user-defined events ao., you cannot use it to subscribe to event and alarms happening.

If using protocols (not using the MIP Library) you should look at the Alarm List sample.

https://doc.developer.milestonesys.com/html/index.html?base=samples/protocolsamples/alarmlist/readme.html&tree=tree_3.html

Hello Bo and thank you for getting back to me.

In one of the developers; videos discussing the REST interface, it was mentioned that the long-term plan is to move all the APIs to REST.

We never developed for .NET and always stayed platform-agnostic using REST or SOAP.

We already successfully implemented the REST code to log in and retrieve certain information, now, we just need to retrieve alarms and perhaps events.

When do you plan to offer this? We have quite a bit of experience supporting similar functionality with other platforms and, if helpful, we could suggest common practices.

Perhaps we can take this thread offline…

BR,

Alessandro

I am sorry but there is no time table for these plans. Please sign up for news and follow notifications on the Milestone web site.

Hi,
I am using 2025R3 version of Milestone management server. Is it possible to subscribe to events and alarms with RESTAPI now?

Thanks in advance!

Regards,
Priyanka Koneti

You can subscribe to and poll Events and poll for Alarms using REST.

Events

Events over WebSocket

Milestone XProtect Events and Status WS API Reference

Alarms

Hi,
Thank you for the response. I am currently working with an application (non .NET environment) that uses SOAP, and I am in the process of replacing it with a REST API to subscribe to events and retrieve alarms from the management server. I attempted to create an event session and an alarm session using a POST request with the endpoint URL below.

http://ipaddress/api/rest/v1/alarmSessions

http://ipaddress/api/rest/v1/eventSessions

I was unable to create the session. The server returned an “HTTP/1.1 400 Bad Request” response, with the message: *“The input was not valid.”

Could you please confirm whether there might be an issue with the URL? Additionally, are there any server-side configurations that need to be updated?

Thank you in advance for your assistance.

There is no sample using sessions. This experiment of mine might be useful…

Extracting the id and using it again

Hi,

Thank you for your example. I am now able to retrieve the session ID and the list of events after adding the session ID to the URL, and this part is working correctly.

However, I would like to understand how to verify events when they are triggered from the server.

For example, in SOAP, I have subscribed to events using the session ID (via the SubscribeEventStatus method). When I navigate to user-defined events, select an event, and click “Test Event,” I receive a notification in my application indicating that the event has been triggered.

How can I receive or verify similar event notifications when using REST?

Regards,
Priyanka Koneti

The sessions, as outlined above is not really a subscription, you simply run the GET at a regular interval and in this way you are following the changes.
For events there is another method, that I would like to recommend instead.

See the Milestone XProtect WebSockets Messaging API (1.0.0), and the Event and State Viewer sample. This is the recommended way to subscribe to events.

Hi,

I think the Event and State Viewer sample uses WebAPI. I am using REST API, Is there any sample with RESTAPI?

No.

Hi,

I have reviewed the provided links. Could you please let me know if there is any documentation available for subscribing to events using the REST API?

https://doc.developer.milestonesys.com/mipvmsapi/api/config-rest/v1/#tag/RecordingServer

The REST Configuration and REST Events documentation are, confusingly, two separate pages based on different YAML files. Here is the Events documentation.

The complete list of RESTful APIs:

As far as I know, it isn’t technically possible to subscribe using REST, because REST has no communication beyond direct responses to your requests. The session endpoints are the closest alternative. Since eventSession works very similarly to alarmSession, it might be worth adjusting the experiment mentioned above.

Like Alarms, you can poll for Events using the REST API. Furthermore you can subscribe to Events using the WebSocket API.

This is how you can poll for Events:

First create the eventSession, like this:

POST https://{server}/api/rest/v1/eventSessions
Authorization: Bearer ey…
Content-Length: 91
Content-Type: application/json; charset=utf-8

{"filterBy": [],"orderBy": [ { "target": "time", "direction": "desc" } ]}

which returns a session id:

{"id":"217c3359-f907-41e7-bdbf-08c9ef824bc2",…

Then you get the related Events using the session id:

GET https://{server}/api/rest/v1/eventSessions/217c3359-f907-41e7-bdbf-08c9ef824bc2/events
Authorization: Bearer ey..


HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 5231

{"data":{
   "deletedFromSession":[],
   "addedToSession":[
      {"specversion":"1.0","type":"dd3e6464-7dc0-405a-a92f-6150587563e8",…


  • every time you get like that, you’ll get the delta since the last get.

Please make sure you apply the Content-Type header to the requests:

Content-Type: application/json; charset=utf-8