WebUI (query) API?

Does anyone know if the WebUI (specifically the query component) is available via Rest API?

1 Like

Hello!

The WebUI query functionality is available via rest.

The entry points are:
/api/clientquery
/api/clientqueryresults

The XSD for formatting requests has been updated and is available here: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Tivoli%20Endpoint%20Manager/page/BESAPI.xsd

4 Likes

Hi, thanks for the info. I’m trying to get the POST to work to execute a query but no luck, I get “Requested resource does not exist.” so I must be missing something…

:52311/api/clientquery

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="BES.xsd">
    <ClientQuery>
        <ApplicabilityRelevance>true</ApplicabilityRelevance>
        <QueryText>version of operating system</QueryText>
    <Target>
        <ComputerName>root</ComputerName>
    </Target>
    </ClientQuery>
</BES>

I’m assuming you’re doing this against a 9.5.2 environment? I don’t see an issue with your XML, and I was able to successfully test it in my lab:

R:\temp>type query.txt
<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
    <ClientQuery>
        <ApplicabilityRelevance>true</ApplicabilityRelevance>
        <QueryText>version of operating system</QueryText>
                <Target>
                        <ComputerName>BIGFIX</ComputerName>
                </Target>
    </ClientQuery>
</BESAPI>

R:\temp>curl -X POST --data-binary @query.txt --user aram https://<root server:port>/api/clientquery
Enter host password for user 'aram':
<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
        <ClientQuery Resource="http://<root server:port>/api/clientquery/6">
                <ID>6</ID>
        </ClientQuery>
</BESAPI>

R:\temp>curl --user aram https://<root server:port>/api/clientqueryresults/6
Enter host password for user 'aram':
<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
        <ClientQueryResults>
                <QueryResult>
                        <ComputerID>4616437</ComputerID>
                        <ComputerName>BIGFIX</ComputerName>
                        <SubQueryID>1</SubQueryID>
                        <IsFailure>0</IsFailure>
                        <Result>6.1.7601</Result>
                        <ResponseTime>4000</ResponseTime>
                </QueryResult>
        </ClientQueryResults>
</BESAPI>
2 Likes

Make sure the URL to the root starts with https://

After changing BES to BESAPI in the xml, it works fine via curl. Interesting enough I can’t seem to get the POST to work in Postman (but the GET against https://server.com:52311/api/clientqueryresults/8 works just fine via Postman)… strange.

Is BESAPI a new requirement (rather than just BES) in the XML node?