REST query site type

written by RobG1

To query a fixlet, I need to know the site type and name, api/fixlet/external/Enterprise%20Security/1401877. How do I query IEM to get the site type, “external” in this case? The console shows a type column. But I cannot seem to find a type attribute for a site.

written by jgstew

You can query this information using session relevance through the REST api. You might also be able to get it using api/sites

written by RobG1

I was looking for the details on how to do it with the rest API. The api/sites does not have this information unless there is a way to pass additional information.

It looks like external sites is a flag. A query using eternal site flag of it in the query returned the value. The customer flag appears to be similar.

written by jgstew

You can use Session Relevance through the REST API. That is how you would figure out a site is “External” or not.

written by RobG1

I’m not sure how I go about doing using Session Relevance for my query. I know I can obtain the “external/custom/operator/master site flag” for a particular site. Do you have an example?

Thanks,

written by jgstew

I’m not sure what you already know going into making your query… if you already know the fixlet name, or ID, or ???

Something like this:

(((if (external site flag of it) then “external” else if (custom site flag of it) then “custom” else if (operator site flag of it) then “operator” else if (master site flag of it) then “actionsite” else ERROR “unknown”) & “/” & (name of it)) of site of bes fixlet whose(id of it =
1401877
))

written by jgstew

It does seem silly to me that the API uses the form:

api/fixlet/SiteType/Site/ID

when I figure it should be more like:

api/fixlet/ID

written by RobG1

Thanks for the response. I updated my query to get all the site flags and then the java code parses them. Your query is makes the java code easier, but the query gets messy. Is there any limitation on how long the query can be for the REST API?

written by jgstew

I’m guessing there is an upper limit to the query, but I have no clue what that would be. I would imagine the limitation would be whatever the limit for URLs is.

written by JesperLarsen

a VERY unscientific investigation based on a rest relevancequery (with a LOT of spaces in it) says bout 1790 characters.

response is then:

This expression has a very long string.

:slight_smile:

/J

written by JesperLarsen

Im guessing the reason for having to specify a site is, that the ID is only unique within a site…

In the below example on my setup, the user querying has access to 12 sites having a fixlet of Id = 1 (had to add a few s’es to handle plural data)

example:

(((if (external site flag of it) then “external” else if (custom site flag of it) then “custom” else if (operator site flag of it) then “operator” else if (master site flag of it) then “actionsite” else ERROR “unknown”) & “/” & (name of it)) of sites of bes fixlets whose(id of it = 1))

->

external/BES Support

external/BigFix Remote Desktop for Windows

external/Patching Support

external/Server Automation

external/Trend Core Protection Module

external/Trend Micro Mac Protection Module

external/Software Distribution

external/CIS Checklist for Android 4_x

external/IBM Software Inventory

external/CIS Checklist for iOS 6

external/IBM License Reporting

external/IBM Endpoint Manager for Software Use Analysis

written by jgstew

That makes sense as far as the reason for having the site in the query.

This should work then:

((((if (external site flag of it) then “external” else if (custom site flag of it) then “custom” else if (operator site flag of it) then “operator” else if (master site flag of it) then “actionsite” else ERROR “unknown”) of site of it) & “/” & (name of site of it) & “/” & (id of it as string)) of bes fixlets whose(id of it =
1
AND name of site of it = “
BES Support
”))

Also there should be a property
(type of site)
that would return “external” or “custom” or … directly instead of needing the IF statement like above.