How to get a list of all subfolders and their owners through API in Git

I need to get the list of all sub-folders with their associated owners in the form of csv, with a list of projects and comma delimited column for owners. Please help me to get this information through API and also to get the above information with powershell /python scripting language