Topic
  • 11 replies
  • Latest Post - ‏2014-05-23T18:31:43Z by jgstew
RobG1
RobG1
23 Posts

Pinned topic REST query site type

‏2014-05-16T21:54:34Z | fixlet query rest site

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.

  • jgstew
    jgstew
    52 Posts

    Re: REST query site type

    ‏2014-05-17T15:40:37Z  

     

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

     

  • RobG1
    RobG1
    23 Posts

    Re: REST query site type

    ‏2014-05-19T21:43:06Z  
    • jgstew
    • ‏2014-05-17T15:40:37Z

     

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

     

    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.

  • jgstew
    jgstew
    52 Posts

    Re: REST query site type

    ‏2014-05-20T16:58:24Z  
    • RobG1
    • ‏2014-05-19T21:43:06Z

    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.

     

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

     

  • RobG1
    RobG1
    23 Posts

    Re: REST query site type

    ‏2014-05-20T17:30:42Z  
    • jgstew
    • ‏2014-05-20T16:58:24Z

     

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

     

    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,

  • jgstew
    jgstew
    52 Posts

    Re: REST query site type

    ‏2014-05-20T20:46:06Z  
    • RobG1
    • ‏2014-05-20T17:30:42Z

    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,

     

    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))

     

  • jgstew
    jgstew
    52 Posts

    Re: REST query site type

    ‏2014-05-20T20:48:11Z  

     

    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

     

  • RobG1
    RobG1
    23 Posts

    Re: REST query site type

    ‏2014-05-21T14:53:32Z  
    • jgstew
    • ‏2014-05-20T20:48:11Z

     

    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

     

    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?

  • jgstew
    jgstew
    52 Posts

    Re: REST query site type

    ‏2014-05-21T15:23:32Z  
    • RobG1
    • ‏2014-05-21T14:53:32Z

    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?

     

    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.

     

  • JesperLarsen
    JesperLarsen
    34 Posts

    Re: REST query site type

    ‏2014-05-23T14:40:05Z  
    • jgstew
    • ‏2014-05-20T20:48:11Z

     

    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

     

    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
  • JesperLarsen
    JesperLarsen
    34 Posts

    Re: REST query site type

    ‏2014-05-23T15:08:00Z  
    • RobG1
    • ‏2014-05-21T14:53:32Z

    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?

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

    response is then:

    <Result/>
    <Error>This expression has a very long string.</Error>

    :-)

    /J

  • jgstew
    jgstew
    52 Posts

    Re: REST query site type

    ‏2014-05-23T18:31:43Z  

    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

     

    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.