Rest API analysis data

(imported topic written by mcalvi91)

Is there a way to get the analysis data via the REST api? looking at the analysis apis, it appears it is just the management of the analyses and not getting the data out of it.

(imported comment written by JesperLarsen)

afaik there is no other way to do this, except using the query-feature to do a relevance query returning the properties you define in the query. By using the /api/query you will get back untyped XML like the XML below.

<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
<Query Resource="(id of computer of it, name of property of it, values of it) of ((property results of (bes computers whose (last report time of it &gt; now - (minute * 30)))))">
            <Result>
                    <Tuple>
                            <Answer type="integer">503808</Answer>
                            <Answer type="string">BES Client Version</Answer>
                            <Answer type="string">9.0.787.0</Answer>
                    </Tuple>
                    <Tuple>
                            <Answer type="integer">503808</Answer>
                            <Answer type="string">BES Relay Version</Answer>
                            <Answer type="string">Not Installed</Answer>
                    </Tuple>
        .....

/J

(imported comment written by mcalvi91)

I was headed that directions and was getting time outs so i switched directions to attempt to pull an analysis. guess ill go back to the query method.

(imported comment written by JesperLarsen)

Well, if you hear about a better solution, im all ears :slight_smile: I have experienced big differences in executiontime depending on how the relevance query is made up. But m sure you already thought of that.

Im using the REST API for replication trying to avoid digging directly into the TEM DB. But some of the queries i have converted to use a direct link to the TEM DB as the rest interface is for now not fast enough.

On that note (IBM, are you listening:) It would have been really nice if the response was compressed instead of send uncompressed over the wire. Doing a normal (deflate) compression of a 1.37MB response like the above would compress it into approximately 110K. I know the compression is just a matter of moving load from network to CPU… but in this case i think the factor 10+ would actually help out on load-time. At least for my setup.

Hope you get it going

(imported comment written by mcalvi91)

Found a relevance which doesnt time out.

32584 is the analysis ID (minus the 00- in the front).

( name of property of it, concatenation “|” of values of it) of (results from (bes properties whose ((id of source analysis of it) = 32584 )) of (bes computers whose (operating system of it contains “Win7”)))

(imported comment written by jgstew)

I think the REST API returning compressed data would need to be an option that could be enabled or disabled, or perhaps something that could be specified when making the API call about how the data should be returned.

I’d rather the default was uncompressed XML

Also, we had this exact question about getting analysis results using the /api/analysis method, but that seems to be only for manipulating analyses themselves. /query is the only way to get results as far as I can see.