Convert Role membership criteria json to CSV

:bangbang: Please be sure you’ve read the docs and API specs before asking for help. Also, please be sure you’ve searched the forum for your answer before you create a new topic.

We have over 3000+ roles in production, and I would like to export all role membership criteria and convert that report to a custom csv instead of everything to a csv, only role name and role membership criteria. Could anyone suggest the best way to achieve this? If we have a report in csv format, I can use the role import/export tool to bulk role updates.

You will need to develop a custom script for this. I don’t think there is any OOTB option

Hi

I use the following Ruby script to get all the roles from IDN then I write them to CSV

  offset = 0
  count = 50
  myCount = 0
  roleList = Array.new
	
	# ============
	# Roles
	# ============

  #getRole list returns 50 accounts at a time, so need to loop through it until it returns less than 50
    while count == 50
      url = "#{$config['baseUrl']}/beta/roles"
      responseBody = IDNAPI.get50(url, offset, 50, "", $config['access_token'])
		  count = responseBody.length
		  roleList = roleList.concat(responseBody)
		  offset = offset + 50
    end
    puts "Total number of Roles #{roleList.length()}"
    roleList.each {|a| 	
        myName = a['name'].gsub(/[^[:ascii:]]/, "")
        myDescription = a['description']
        myOwner = a['owner']['name']
        isEnabled = a['enabled']
        lastModified = a['modified']
        isRequestable = a['requestable']
        membership = a['membership']

        <write out to file here the attributes you want.. >
   }

Something like that

1 Like

If you dont need the criteria in JSON, Try looking at the VS Code IDN extension.

It exports role data in a more human readable form.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.