This documentation supports the 11.3 version of BMC Discovery.

To view an earlier version of the product, select the version from the Product version menu.

Example queries

This topic provides examples of queries.

Empty query

The following example returns an error code of 1; this is the result of an empty query. The text to be appended to the command lines for this example is:

username=apiuser\&password=password

In this case, the query=SEARCH%20Host string is missing. Use the cat command to view the output file; it contains only the returned error code; a 1.

No client timeout

You might experience client-side timeouts; in this case you will encounter an unexpected end of file in the output. To avoid this, increase the client timeout to a value in excess of the web server timeout, or disable it entirely.

The following example shows how to disable the wget timeout. If the query takes longer to run than the appliance web server timeout, no output will be received.

$ wget --timeout=0 http://appliance/ui/api/...

Invalid query

The following example returns an error code of 3; this is the result of an invalid query. The text to be appended to the command lines for this example is:

query=SEARCHX%20Host\&username=apiuser\&password=password

The query string now uses SEARCHX instead of SEARCH. This query will fail as there is no SEARCHX command defined in the query language. Use the cat command to view the output file; it contains only the returned error code; a 3.

Authorization failure

The following example shows an authorization failure; this is the result of an invalid password. The text to be appended to the command lines for this example is:

query=SEARCH%20Host\&username=apiuser\&password=wrongpassword

The query string now uses the wrong password, causing an authorization failure returning a server response code of 401. This can be seen on the terminal the command was issued from.

Was this page helpful? Yes No Submitting... Thank you

Comments