The Server doesn't find

Hello,

I run the following API request. Some can be found, but one not. I thought this is the permission of the sites but I used the admin user and it is the same. The server exists in the Console.

api/query?relevance=name of bes computers whose (name of it as lowercase = "<hostname>")

<?xml version="1.0" encoding="UTF-8"?>
<BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
	<Query Resource="name of bes computers whose (name of it as lowercase = &quot;FORNAX0055434&quot;)">
		<Result></Result>
		<Error>Singular expression refers to nonexistent object.</Error>
	</Query>
</BESAPI>

First thing to check if the user you are connecting to API with actually can see this machine in the console. If thatā€™s the case the next thing would be to change the plurality of your relevance statement - you have ā€œbes computersā€ which may return multiple results but ā€œnameā€. Change it to names of bes computers cause if you have 2 machines with the same name it will in fact produce that exact error.

I changed it. it also works for another machine. But this one I want to find, doesnā€™t work.



158.128ms
Plural

You are comparing ā€˜name of it as lowercaseā€™ to an uppercase string, which will not match. Convert the hostname to lowercase as well.

1 Like

it works sometimes.

If the machine in the Console is uppercase, then it doesnā€™t show.
If the machine in the Console is uppercase and in the detail lowercase, then it works.
If the machine in the Console is lowercase and the the detail lowercase, then it works too.

So this lowercase methode doesnā€™t work really.

The same for this.
(names of it as lowercase) of bes computers whose (name of it as lowercase = ā€œhostnameā€)

It works if I put the hostname all lowercase. But it should work with lowercase somehow.

I mean to lowercase both terms. Thatā€™s how we do a case-insensitive comparison. Try

relevance=names of bes computers whose (name of it as lowercase = "&lt;hostname&gt;" as lowercase)
1 Like

Yes, it works, the second case is for the hostname I put in. It can be uppercase too. Many thanks

So to be clear, this is working and meets your need?

1 Like

Yes, I can put the hostname in, uppercase or lowercase. It always.

here ist also for the agent version when doing the agent update.

api/query?relevance=(names of it, agent version of it) of bes computers whose (name of it as lowercase = ā€œHOSTNAMEā€ as lowercase)