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

SOAP and JSON APIs return different results for the same endpoint.

$
0
0

We've been making use of the API for various scripting things, and have had some luck. I built a perl-based script to do some automated tasks, and leveraged the sample code in the SDK. Worked!

 

Now I'm attempting to build a more robust toolkit, but in Ruby. There isn't any ruby sample code in the SDK, so I'm relying on the documentation to build what I need. Due to complexity, I'd hoped to use the REST api as that's pretty easy to get going in Ruby. However, the work has gone slow.

 

Right now I have a POST request that looks like this:

 

POST /SolarWinds/InformationService/v3/Json/Query HTTP/1.1

Accept: */*

Accept-Encoding: gzip, deflate

Authorization: Basic [creds]

Content-Type: application/json

Content-Length: 110

User-Agent: Ruby

Host: 192.0.2.45:17778

 

{"query":"SELECT NodeID from ORION.Nodes Where NodeName=@NodeName","parameters":{"NodeName":"dub-p-master"}}

 

This is returning 403-Forbidden. This is the same query I'm successfully using in the SOAP script, using the same user. The above request matches the documented POST request pretty closely:

 

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}}

 

There are a few differences, such as the existence of the Accept-Encoding header, a different User-Agent, and the lack of a full URL on the POST line. Are these differences meaningful for the REST API, or are permissions handled a bit differently using that method?

 

Orion Platform 2014.2.1, SAM 6.1.1, QoE 1.0, IPAM 4.1, NPM 11.0.1, WPM 2.1.0, IVIM 1.11.0


Viewing all articles
Browse latest Browse all 3719

Trending Articles



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