BigFix Query XML Gone Wrong (For Me)

Where am I going wrong? I’m using this: BigFix Query | BigFix Developer

<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
    <ClientQuery>
    <UseClientContext>true</UseClientContext>
        <ApplicabilityRelevance>true</ApplicabilityRelevance>
        <QueryText>(name of it & " - " & (free space of it / 1000 / 1000) as string & " MB") of drives whose (type of it = "DRIVE_FIXED")</QueryText>
        <Target>
            <ComputerName>testserver</ComputerName>
        </Target>
    </ClientQuery>
</BESAPI>

I use this in PostMan using POST to https://myserver.com:52311/api/clientquery

Result: XML parsing error: expected entity name for reference Line 5, Character 33strong text

When I run the same relevance in Query in WebUI it works a treat :confused:

In the XML schema, most of these are defined as sequences - which means the elements have to appear in the order specified in the schema. In your case, ‘UseClientContext’ should come after ‘QueryText’ and before ‘Target’.

Try

<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
    <ClientQuery>
        <ApplicabilityRelevance>true</ApplicabilityRelevance>
        <QueryText>(name of it & " - " & (free space of it / 1000 / 1000) as string & " MB") of drives whose (type of it = "DRIVE_FIXED")</QueryText>
        <UseClientContext>true</UseClientContext>
        <Target>
            <ComputerName>testserver</ComputerName>
        </Target>
    </ClientQuery>
</BESAPI>

Still got an error :frowning:

XML parsing error: expected entity name for reference Line 4, Character 33

Oh I see,the XML for the QueryText is invalid. Some characters like “&” need to be escaped in XML, or put the query into a CDATA tag (probably easier)