NetXMS REST-API

Started by Manuel Schneider, December 23, 2025, 04:56:42 PM

Previous topic - Next topic

Manuel Schneider

Hi,

I'm trying to build dynamic Dashboards in Grafana using the integrated Web-API, but unfortunately with limited success...

First Question: Is the integrated Web-API complete with all NetXMS-API-Endpoints, or is the integrated one (enabled by including `Module = webapi` in netxmsd.conf) only a lighter version, in which case I should probably switch to the Full-API (netxms-websvc-VERSION.war)?

Second Question: Is there a Bug in the API with user-provided query values?
When querying the Endpoint '/v1/grafana/infinity/object-query' and providing query values, those user-provided query values are not used within object-query.
I've modified my Object-Query to output a debug-column with a serialization of the `$INPUT`-Hashmap, when querying via the NetXMS-Client, I see my Input, but when querying via the API, there is no Input to be seen (see Example in Attachments).

Best regards and Merry Christmas,
Manuel

Tatjana Dubrovica

Hi,

NetXMS actually has two web API options available:

  • New Web API - Enabled by adding Module = webapi to your configuration. This is the modern API that we're actively developing and expanding. While it currently has limited functionality, it includes a dedicated Grafana endpoint that's specifically designed to work well with the Grafana Infinity plugin and requires less data parsing/modification on the Grafana side.
  • Legacy Web API - The older netxms-websvc-VERSION.war service. This has more complete functionality currently but may require more data manipulation when using with Grafana plugins.

Since you're using the Grafana Infinity plugin, which can work with any web API, you have flexibility here. You can use either the new API, the legacy API, or even both depending on which is easier for your specific use case.
For new integrations, I'd recommend trying the new Web API's Grafana endpoint first as it will provide the smoothest experience with the Infinity plugin. However, if you need functionality that isn't yet available in the new API, the legacy service is still a viable option.

Question 2 (inputFields Format):

You're right that the documentation needs correction - I apologize for the confusion. The inputFields parameter should be formatted as a JSON object with key-value pairs, not as an array.
Correct format:
{
   "rootObjectId": 2,
   "queryId": 1,
   "inputFields": {
       "name": "value",
        "anotherField": "anotherValue"
    }
}
The code extracts these fields as a StringMap and supports multiple data types:

Strings (used as-is)
Integers (converted to string representation)
Floating-point numbers (converted to string representation)
Booleans (converted to "true"/"false" strings)

I'll update the documentation to reflect the correct format. Thank you for catching this issue!


Manuel Schneider

Hi Tatjana,

many thanks for your explanation!
With your Info, I've got it working :-)

Best Wishes,
Manuel