0 Replies Latest reply on Jan 26, 2017 7:33 AM by irimierazvan

    Removing AD Groups - Script ?

    irimierazvan

           Hello,

       

      We have enabled LDAP on our instance and unforunately we pulled ~ 30k AD groups into Jive. We have applied an AD filter fro the groups, however i was looking for a way to bulk remove the federate groups.

       

      I am quite new to API, however i managed to get groups removed using the following API call:

       

      1. Got a Json of a block of 100 AD groups: https://xxxx.com/api/core/v3/securityGroups?filter=federated%3Atrue&fields=%40standard&sort=nameAsc&count=100&startIndex=0

       

      Sample below:

       

      {
      "itemsPerPage" : 100,
      "links" : {
      "next" : "https://xxx.com/api/core/v3/securityGroups?filter=federated%3Atrue&fields=%40standard&sort=nameAsc&count=100&startIndex=100"
      df
      "list" : [ {
      "id" : "3953",
      "resources" : {
      "members" : {
      "allowed" : [ "GET", "POST" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/3953/members"
      },
      "self" : {
      "allowed" : [ "DELETE", "PUT", "GET" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/3953"
      },
      "administrators" : {
      "allowed" : [ "GET", "POST" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/3953/administrators"
      }
      },
      "published" : "2016-08-17T13:02:04.181+0000",
      "updated" : "2016-08-22T21:02:56.403+0000",
      "description" : "Dynamic group synched with HR",
      "federated" : true,
      "name" : "zDET Staff no partners-Auto",
      "type" : "securityGroup"
      }, {
      "id" : "11649",
      "resources" : {
      "members" : {
      "allowed" : [ "GET", "POST" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/11649/members"
      },
      "self" : {
      "allowed" : [ "DELETE", "PUT", "GET" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/11649"
      },
      "administrators" : {
      "allowed" : [ "GET", "POST" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/11649/administrators"
      }
      },
      "published" : "2016-08-22T07:10:43.358+0000",
      "updated" : "2016-08-25T12:51:33.496+0000",
      "description" : "",
      "federated" : true,
      "name" : "HEL Everyone",
      "type" : "securityGroup"
      }, {
      "id" : "7529",
      "resources" : {
      "members" : {
      "allowed" : [ "GET", "POST" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/7529/members"
      },
      "self" : {
      "allowed" : [ "DELETE", "PUT", "GET" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/7529"
      },
      "administrators" : {
      "allowed" : [ "GET", "POST" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/7529/administrators"
      }
      },
      "published" : "2016-08-18T12:42:13.337+0000",
      "updated" : "2016-08-23T16:34:32.018+0000",
      "description" : "Dynamic group synched with HR",
      "federated" : true,
      "name" : "zTOR Host Office",
      "type" : "securityGroup"
      }, {
      "id" : "5261",
      "resources" : {
      "members" : {
      "allowed" : [ "GET", "POST" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/5261/members"
      },
      "self" : {
      "allowed" : [ "DELETE", "PUT", "GET" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/5261"
      },
      "administrators" : {
      "allowed" : [ "GET", "POST" ],
      "ref" : "https://xxx.com/api/core/v3/securityGroups/5261/administrators"
      }
      },

       

      My question is, how do I get this translated into a csv file, as i need only the resources/self/ref: i.e "https://xxx.com/api/core/v3/securityGroups/5261" and a DELETE request for each of the relf/refs. I know a bit of PHP and Javascript, is there away to get a full list of these AD groups as the JSON responses are limited to 100 per query and second once i retrieve this list how cna i remove them in bulk?

       

      Thank you in advance.