Quantcast
Channel: THWACK: Popular Discussions - Orion SDK
Viewing all articles
Browse latest Browse all 3719

SWIS REST/JSON API

$
0
0

Starting with NPM 10.4, SWIS now supports a REST/JSON API in addition to the existing SOAP API. The operations supported by each API are identical: the six basic operations of Query, Invoke, Create, Read, Update, and Delete; and the data you can access through each API is the same. The difference is that the REST/JSON API avoids the complexities of XML and SOAP, though it gives up the ability to have a client wrapper generated from WSDL.

 

Both APIs will be supported by the product indefinitely - the SOAP API is not deprecated or replaced by the REST API.

 

Request and Response Formats

Query

Request

GET https://localhost:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+Uri+FROM+Orion.Pollers+ORDER+BY+PollerID+WITH+ROWS+1+TO+3+WITH+TOTALROWS HTTP/1.1
Authorization: Basic YWRtaW46
User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3
Host: localhost:17778
Accept: */*

Response

HTTP/1.1 200 OK
Content-Length: 244
Content-Type: application/json
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Jul 2012 19:38:52 GMT
{"totalRows":13,"results":[{"Uri":"swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=4"},{"Uri":"swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=6"},{"Uri":"swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=7"}]}

Body reformatted for easier reading
{

 

    "totalRows": 13,

    "results": [

        { "Uri": "swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=4"},

        { "Uri": "swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=6"},

        { "Uri": "swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=7"}

    ]

}

Query with Parameters

Request

POST https://localhost:17778/SolarWinds/InformationService/v3/Json/Query HTTP/1.1
Authorization: Basic YWRtaW46
User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3
Host: localhost:17778
Accept: */*
Content-Type: application/json
Content-Length: 130
{"query":"SELECT Uri FROM Orion.Pollers WHERE PollerID=@p ORDER BY PollerID WITH ROWS 1 TO 3 WITH TOTALROWS","parameters":{"p":9}}

Response

HTTP/1.1 200 OK
Content-Length: 99
Content-Type: application/json
Server: Microsoft-HTTPAPI/2.0
Date: Tue, 07 Aug 2012 17:36:27 GMT
{"totalRows":1,"results":[{"Uri":"swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=9"}]}

Invoke

Request

POST https://localhost:17778/SolarWinds/InformationService/v3/Json/Invoke/Metadata.Entity/GetAliases HTTP/1.1
Authorization: Basic YWRtaW46
User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3
Host: localhost:17778
Accept: */*
Content-Type: application/json
Content-Length: 39
["SELECT B.Caption FROM Orion.Nodes B"]

Response

HTTP/1.1 200 OK
Content-Length: 19
Content-Type: application/json
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Jul 2012 19:23:27 GMT
{"B":"Orion.Nodes"}

The Metadata.GetAliases verb takes one string argument and returns a PropertyBag.

Create

Request

POST https://localhost:17778/SolarWinds/InformationService/v3/Json/Create/Orion.Pollers HTTP/1.1
Authorization: Basic YWRtaW46
User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3
Host: localhost:17778
Accept: */*
Content-Type: application/json
Content-Length: 92
{"PollerType":"hi from curl 2", "NetObject":"N:123", "NetObjectType":"N", "NetObjectID":123}

Response

HTTP/1.1 200 OK
Content-Length: 69
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Jul 2012 19:27:11 GMT
"swis:\/\/tdanner-dev.swdev.local\/Orion\/Orion.Pollers\/PollerID=19"

Read

Request

GET https://localhost:17778/SolarWinds/InformationService/v3/Json/swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=6 HTTP/1.1
Authorization: Basic YWRtaW46
User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3
Host: localhost:17778
Accept: */*

Response

HTTP/1.1 200 OK
Content-Length: 245
Content-Type: application/json
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Jul 2012 19:30:02 GMT
{"PollerID":6,"PollerType":"V.Details.SNMP.Generic","NetObject":"V:1","NetObjectType":"V","NetObjectID":1,"DisplayName":null,"Description":null,"InstanceType":"Orion.Pollers","Uri":"swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=6"}

Update

Request

POST https://localhost:17778/SolarWinds/InformationService/v3/Json/swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=6 HTTP/1.1
Authorization: Basic YWRtaW46
User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3
Host: localhost:17778
Accept: */*
Content-Type: application/json
Content-Length: 29
{"PollerType":"hi from curl"}

Response

HTTP/1.1 200 OK
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Jul 2012 19:32:06 GMT

Delete

Request

DELETE https://localhost:17778/SolarWinds/InformationService/v3/Json/swis://tdanner-dev.swdev.local/Orion/Orion.Pollers/PollerID=16 HTTP/1.1
Authorization: Basic YWRtaW46
User-Agent: curl/7.20.0 (i386-pc-win32) libcurl/7.20.0 OpenSSL/0.9.8l zlib/1.2.3
Host: localhost:17778
Accept: */*

Response

HTTP/1.1 200 OK
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Jul 2012 19:37:33 GMT

Viewing all articles
Browse latest Browse all 3719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>