Difference between revisions of "Web service API"

1,479 bytes added ,  18:14, 13 September 2022
m
Text replacement - "^" to "{{deprecated}}"
m (Text replacement - "^" to "{{deprecated}}")
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
Web service API provides access to NetXMS via HTTP/HTTPS. API calls are REST-like (although not purely RESTful) and uses JSON for data exchange.
{{deprecated}}Web service API provides access to NetXMS via HTTP/HTTPS. API calls are REST-like (although not purely RESTful) and uses JSON for data exchange.


= Session Management =
= Session Management =
Line 43: Line 43:
Get all nodes and containers:
Get all nodes and containers:
  GET /objects?class=container,node
  GET /objects?class=container,node
Get DCI Summary adHoc
POST /summaryTable/adHoc
Post payload:
<pre>
{
    "baseObject":"ContainerName",
    "multiInstance":false,
    "columns": [
        {
        "columnName":"Free form name that will be used in return table for this column",
        "dciName":"Name of DCI, that will be used for filtering"
        },
        {
        "columnName":"Name2",
        "dciName":"DCIName2"
        }
    ]
}</pre>


== Get Specific Object ==
== Get Specific Object ==
'''GET''' /objects/''id''
'''GET''' /objects/''id''
== Get Last Values for Object ==
'''GET''' objects/''id''/lastvalues
== CURL Test ==
Test API with Curl
<pre>
$ curl -X POST --data '{"login":"user","password":"pass"}' "http://localhost:8080/netxms-websvc/sessions"
{
  "sessionHandle": "8338e7f3-ba99-46c5-9fd6-84b38cc5d715",
  "session": {
    "server": {
      "address": "127.0.0.1",
      "version": "2.2.8",
      "color": "",
      "id": 3283229296059149299,
      "timeZone": "CET+02CEST"
    },
    "user": {
      "name": "user",
      "id": 8,
      "globalAccessRights": 825439032336
    },
    "encrypted": false,
    "objectsSynchronized": false,
    "passwordExpired": false,
    "zoningEnabled": false
  }
}
$ curl -X GET --cookie "session_handle=8338e7f3-ba99-46c5-9fd6-84b38cc5d715" "http://localhost:8080/netxms-websvc/objects?class=container,node"
.. prints some data ..
</pre>
= Java 10 =
If curl test works but grafana returns "Internal error" ({"description":"Internal error","error":46}")<br>
Add "--add-modules java.xml.bind" to JAVA_OPTS in /etc/default/tomcat8