API Python Workspace and Model IDs




I have successfully setup my Python environment. I did have a question around a specific requirement.




From the above link, I have tried the “get models”, “get modelinfo”, and “getworkspaces” Python scripts. What I am looking for is a Python API script which can return the following fields:


1) Model ID

2) Model Name

3) Workspace ID

4) Workspace Name


Unfortunately the templates I mentioned above return at most 3 of these 4 requirements. I am able to get all of these fields if I run 2 separate scripts. 1 to return Model ID, Model Name, and Workspace ID and another to get Workspace ID and Workspace Name.


Is there a way to get all of the above information in 1 Get request? And then write to CSV (I know how to do this part based on some Googling)? 

Any help here would be greatly appreciated!

Best Answer


  • This worked great! Thank you @kevin.cho.


    Yes I appreciate the level of detail. I wanted to see if there was a quick script available to achieve this before going down the path of creating my own custom script.


    This is awesome.

  • Nice one @kevin.cho - just added this to my private list of best practices. Kudos. Would make a great best practice.

  • I'm in the process of writing up some documentation for my team, and have also started a draft article in the Community Content/Best Practices section 🙂 

  • Amazing! I am sure both @JaredDolich and I (along with the rest of the Anaplan/Python Community) would be thrilled to see all of the gems of knowledge you've got up your sleeve 🙂 @kevin.cho