Querying BigFix for computer by name from a script (REST-API)

Apologies for the simple question.

I am following tutorial https://developer.bigfix.com/rest-api/gettingstarted.html

I am able to get the list of computers (listing A) and query information about a specific computer by number (listing B).
I am struggling with querying using relevance (listing C).

Any help is appreciated.

Thank you,
Aleksandr

A) I am able to get the list of computers:

[me@myhost ~]$ curl -k -u me:mypasswd https://mybigfix:52311/api/computers 2>curl.err | egrep “Computer Resource” | head -8
<Computer Resource=“https://mybigfix:52311/api/computer/713
<Computer Resource=“https://mybigfix:52311/api/computer/1926
<Computer Resource=“https://mybigfix:52311/api/computer/4238
<Computer Resource=“https://mybigfix:52311/api/computer/4869
<Computer Resource=“https://mybigfix:52311/api/computer/8153
<Computer Resource=“https://mybigfix:52311/api/computer/9039
<Computer Resource=“https://mybigfix:52311/api/computer/19997
<Computer Resource=“https://mybigfix:52311/api/computer/20687
[me@myhost ~]$

B) I am able to query information about a specific computer by number:

[me@myhost ~]$ curl -k -u me:mypasswd https://mybigfix:52311/api/computer/1627340086 2>curl.err | head -8
<?xml version=“1.0” encoding=“UTF-8”?>
<BESAPI xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“BESAPI.xsd”>
<Computer Resource=“https://mybigfix:52311/api/computer/1627340086”>
<Property Name=“Computer Name”>mycomputer
<Property Name=“OS”>Linux Red Hat Enterprise Server 6.2 (2.6.32-754.43.1.el6.x86_64)
<Property Name=“CPU”>2400 MHz Xeon
<Property Name=“Last Report Time”>Tue, 30 Jan 2024 14:48:31 +0000
<Property Name=“Locked”>No
[me@myhost ~]$

C) I can’t figure out how to query using relevance:

[me@myhost ~]$ curl -k -u me:mypasswd https://mybigfix:52311/api/query?relevance=(computer name contains “mycomputer” )
<?xml version=“1.0” encoding=“UTF-8”?>
<BESAPI xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“BESAPI.xsd”>
<Query Resource="(computer">
<Result></Result>
<Error>This expression could not be parsed.</Error>
</Query>
</BESAPI>
curl: (6) Couldn’t resolve host 'name’
curl: (6) Couldn’t resolve host 'contains’
curl: (7) couldn’t connect to host
curl: (6) Couldn’t resolve host ‘)’
[me@myhost ~]$
[me@myhost ~]$ curl -k -u me:mypasswd https://mybigfix:52311/api/query?relevance=“computer mycomputer”
<?xml version=“1.0” encoding=“UTF-8”?>
<BESAPI xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“BESAPI.xsd”>
<Query Resource=“computer”>
<Result></Result>
<Error>The operator “computer” is not defined.</Error>
</Query>
</BESAPI>
[me@myhost ~]$

Curl is treating the space in your query as terminating the url parameter. Have a look at the thread at Bes Properties that are not set or unkown causing relevance query issue for tips on using curl more effectively - storing the query in a text file and having curl do the url-encoding for you.