Just a bit more to round this out…
When I sent a more complex query, I got an error message “String did not contain a closing quotation mark”. I believe that’s because curl was handling the pipe operator “|” as a shell command. My workaround is to change the query file to take ‘relevance=’ off the front and pass that explicitly to curl
curl --insecure --user username --data-urlencode "output=json" -X POST "https://bes-root-server:52311/api/query" --data-urlencode "relevance@query.txt"
Contents of query.txt:
(
name of item 0 of it|"Computer Name missing",
(if (size of item 1 of it = 1) then
((if it = "" then
"No values"
else it) of concatenation ";" of
values of results (item 0 of it,
elements of item 1 of it))
else
(if (size of item 1 of it > 1) then
(("Duplicates: " & concatenation "|" of ((name of it) & "=" & (id of it as string)) of elements of item 1 of it) as string)
else
("Property does not exist")))
) of (elements of item 0 of it ,item 1 of it) of
(set of BES computers whose (name of it as uppercase is "MY-COMPUTERNAME"),
set of bes properties whose (name of it as lowercase = ("dmi family") as lowercase))