Topic
  • 5 replies
  • Latest Post - ‏2014-04-28T15:12:05Z by vpetrell
vpetrell
vpetrell
3 Posts

Pinned topic REST API Updating a Computer Group

‏2014-04-24T16:22:37Z |

Hello,

Has anyone been able to use the rest API to add a computer to a computer group?

Any details or advice would be greatly appreciated.

Thanks

  • JesperLarsen
    JesperLarsen
    34 Posts

    Re: REST API Updating a Computer Group

    ‏2014-04-25T12:04:07Z  

    Sounds like you want to point out computers like you do when you create manual groups in the Management Console.

    AFAIK you can only operate on dynamic computergroups thrugh the REST API. When doing dynamic groups, you can (if you want to target specific computers)  target the computers by relevance:

     

    PUT https://master.myrest.com:52311/api/computergroup/operator/myoperator/123 HTTP

    <?xml version="1.0" encoding="utf-8"?>
    <BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <ComputerGroup>
      <Title>TheGroupName</Title>
      <Domain>BESC</Domain>
      <JoinByIntersection>true</JoinByIntersection>
      <SearchComponentRelevance Comparison="IsTrue">
       <Relevance>exists (12344;12345) whose (it = computer id)</Relevance>   
      </SearchComponentRelevance>
    </ComputerGroup>
    </BES>
    

    /J

  • vpetrell
    vpetrell
    3 Posts

    Re: REST API Updating a Computer Group

    ‏2014-04-25T18:31:45Z  

    Sounds like you want to point out computers like you do when you create manual groups in the Management Console.

    AFAIK you can only operate on dynamic computergroups thrugh the REST API. When doing dynamic groups, you can (if you want to target specific computers)  target the computers by relevance:

     

    PUT https://master.myrest.com:52311/api/computergroup/operator/myoperator/123 HTTP

    <pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr"><?xml version="1.0" encoding="utf-8"?> <BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ComputerGroup> <Title>TheGroupName</Title> <Domain>BESC</Domain> <JoinByIntersection>true</JoinByIntersection> <SearchComponentRelevance Comparison="IsTrue"> <Relevance>exists (12344;12345) whose (it = computer id)</Relevance> </SearchComponentRelevance> </ComputerGroup> </BES> </pre>

    /J

    Thanks for replying, I'm actually looking to add computers to dynamic groups so this is exactly what I need.

    I have been able to easily navigate and test the "get" commands but having some trouble with the "put".

    Are there any tools I can use to easily test this out?

    I'm currently developing this using the IPL language of Netcool Impact.

  • JesperLarsen
    JesperLarsen
    34 Posts

    Re: REST API Updating a Computer Group

    ‏2014-04-25T21:12:59Z  
    • vpetrell
    • ‏2014-04-25T18:31:45Z

    Thanks for replying, I'm actually looking to add computers to dynamic groups so this is exactly what I need.

    I have been able to easily navigate and test the "get" commands but having some trouble with the "put".

    Are there any tools I can use to easily test this out?

    I'm currently developing this using the IPL language of Netcool Impact.

    To do these one-off tests, I use a plugin for Chrome called postman.

    In postman you just put in the uri of the group ( in this case, the site used is an operatorsite is named ooo) and groupId 123

    https://master.myIEMServer.net:52311/api/computergroup/operator/ooo/123

    and then select PUT as method, and paste in the above said XML as raw data and press send. 

    You can also add the username/pass as a static header if you want to call several times. otherwise, just fire this one and it will prompt you for the user/pass for that site. 

     

  • jgstew
    jgstew
    52 Posts

    Re: REST API Updating a Computer Group

    ‏2014-04-26T14:14:42Z  
    • vpetrell
    • ‏2014-04-25T18:31:45Z

    Thanks for replying, I'm actually looking to add computers to dynamic groups so this is exactly what I need.

    I have been able to easily navigate and test the "get" commands but having some trouble with the "put".

    Are there any tools I can use to easily test this out?

    I'm currently developing this using the IPL language of Netcool Impact.

     

    I also use CURL on the command line to get things working before trying to add it to a program.

     

  • vpetrell
    vpetrell
    3 Posts

    Re: REST API Updating a Computer Group

    ‏2014-04-28T15:12:05Z  

    Thanks guys, will give those tools a try!