DX NetOps Manager

Expand all | Collapse all

How can I rename Groups via Rest?

Jump to Best Answer
  • 1.  How can I rename Groups via Rest?

    Posted 08-03-2017 08:09 AM

    Hi,

     

    I have the following question: How can I rename a Group Name via Rest?

     

    Thanks a lot!



  • 2.  Re: How can I rename Groups via Rest?
    Best Answer

    Posted 08-03-2017 10:15 AM

    You can get the group information from PC using the GET call and then edit the name in the XML output you get to PUT it on the same group ID.
    You should find what you need here: https://docops.ca.com/ca-performance-management/3-1/en/administrating/performance-center-rest-webservices/use-web-services-to-manage-groups



  • 3.  Re: How can I rename Groups via Rest?

    Posted 08-03-2017 10:19 AM

    Thanks a lot for the useful hint.



  • 4.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 07:15 AM

    I tried, but the PUT Method is not allowed. And when I use POST I get 400 bad Request The following Group Path is invalid: Not specified.



  • 5.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 07:50 AM

    I'm fairly certain there is a PUT method for groups. Is this a tenant group? Which user are you using? Which version of CA PC? Did you retrieve the XML from the GET call? Can you share it there?

    (sorry I don't have any system here to try it but I'm sure i did that already)



  • 6.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 07:57 AM

    Hi thanks for your answer.

     

    I used CA PM 3.1.

     

    First I send a GET request with: ../pc/center/webservice/groups/groupPath/MyGroup/items

     

    The Group is in /All Groups/Groups/MyGroup Only the relativ Path is accepted, when I use the absolut Path with the Delimiter &2F, then I get the message invalid Path.

     

    The result in Payload is: <group id="10976" name="MyGroup" description="" type="group" subType="user"/>

     

    When I send a GET request to  ../pc/center/webservicegroups/groupItemId/10976 I get tho following: <GroupTree id="10976" inheritDefault="true" path="/All Groups/Groups/MyGroup"/>



  • 7.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 08:01 AM

    This is the request, when I send a PUT:

    • Status Code: 405 Method Not Allowed
    • Allow: DELETE,POST,GET,OPTIONS,HEAD


  • 8.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 08:07 AM

    Ok so the first query should work but should be using "groupPath/All%20Groups%2FGroups%2FMyGroup".

     

    However what you did should be ok too with the ID you retrieved and is actually safer I guess. Actually I think you are right you must use POST and not PUT in that case. But that should be sent to 

    http://PC_host:8181/pc/center/webservice/groups/true/false

    The last "false" depends wether you want to allow deletion of items or not.

    The first "true" is to say you want to reuse the same ID which should lead to changing settings and keeping the rest intact with the same ID.



  • 9.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 08:15 AM

    I tried with /external-link.jspa?url=http%3A%2F%2FPC_host%3A8181%2Fpc%2Fcenter%2Fwebservice%2Fgroups%2Ftrue%2Ftruehttp://PC_host:8181/pc/center/webservice/groups/true/false

     

    and the Body:

     

    <GroupTree id="10976" name="RenameName" inheritDefault="true" path="/All Groups/Groups"/>

     

    I get  200 OK. But the Name of the Group is still the same MyGroup.

    <GroupTree id="3690" inheritDefault="true" path="/All Groups/Groups">

    <Group desc="" id="10976" inherit="true" name="MyGroup" result="Not Deleted" type="user group"/>
    </GroupTree>


  • 10.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 08:30 AM

    Then maybe I am remembering wrong and what I did was creating a new group with the new name and then deleting the old one. Would that work for you?

    1. You do the GET to get the whole definition of your group.

    2. You create the new group with the POST and the new name in the XML BODY, using this time "false/false" at the end.

    3. You delete the group ID of the original group.

     

    You should end up with the wanted result but it might require some rework on dashboards in case you used the original group as a fixed group.

     

    Maybe GiMMaY would be able to confirm there is no other call to rename a group?



  • 11.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 08:36 AM

    Thanks a lot for your effort.

     

    For a automation process via Script e.g. Shell or others I think ist to ornate. But I will keep it in the back =)



  • 12.  Re: How can I rename Groups via Rest?

    Posted 08-04-2017 01:06 PM

    Actually I just got the confirmation there's no webservice call in PC to rename a group. So what I proposed is the only alternative. I created an idea so we can push the idea to product development: https://communities.ca.com/ideas/235736409-rest-call-to-rename-groups-in-pc
    Please vote for it! ;)



  • 13.  Re: How can I rename Groups via Rest?

    Posted 08-08-2017 01:27 AM

    Hi cust,

     

    I invite you to try again your tests on renaming as after I opened the idea on the link given above, I then got confirmed it should work with the instruction in the post (use true for reuse ids). Name should be changed. If that's not the case and you have it "documented" could you please add a comment on the idea so that stoma11 can follow that up?