Web API alarm list for single node

Started by Sch.Donat, August 27, 2020, 04:02:41 PM

Previous topic - Next topic

Sch.Donat

Hi all!

I tried out the web API interface (3.4.313 server and 3.4.318 web API version). Getting the full alarm list worked fine, but when I want to query a single node, the request is returned with status code 405 (method not allowed) and with body:
{
    "description": "Internal error",
    "error": 46
}


The path used is <ip>/netxms-websvc/alarms/<nodeid>

Am I using the wrong path?

Regards

Filipp Sudanov

Hi!

The way you tried is not yet implemented. What works is this way:

/alarms?objectId=123

/alarms?objectGuid=XXX

If you need to see alarms for all nodes under a container:
/alarms?objectId=123&includeChildObjects=true

Sch.Donat

Hi!

Thanks, this way it works.
Is it possible to only query alarms from a given time period, or those that were generated in the last X seconds? Adding the filters from DCI querying doesn't seem to work.

Best regards

Filipp Sudanov

Yes, you can use createdBefore, createdAfter, updatedBefore, updatedAfter. Unix timestamp should be provided to these filters.

Also, you can filter by alarm state, e.g.
alarm=outstanding
or
alarm=outstanding,acknowledged

And there's a good thing resolveReferences=true, in this case you'll have names of all related objects in the json output.

There are also filters by user name, you can check in sources for these: src/client/nxapisrv/java/src/main/java/org/netxms/websvc/handlers/Alarms.java


Sch.Donat