Retrieve Model ID and Workspace ID via API then load as CSV?

Hello All,

 

I was wondering if it is possible to retrieve Workspace ID and Model IDs of any given Model which then can be pulled into a CSV file? Then imported into my current model? 

 

What I am looking for is something like this: 

 

1) Retreive Current Model Details via API, extract into CSV.

 

*Looking for ways to grab either: a) a single Model ID, or b) All Model IDs in a Workspace

 

Sample: 

dsoomar002_0-1616364238062.png

 

2) a) Import CSV file into Current Model to update Details. Example

 

dsoomar002_2-1616364368975.png

 

Does anyone know of a way to do this? Even just retrieving the IDs into a CSV file would be huge. 

Best Answers

  • JaredDolich
    Answer ✓

    @DaanishSoomar 

    Well, I'm kind of partial to Python for something like that. Just as you mentioned, you can use the API to get the workspaces. Then for each workspace get the models. Combine them then save off as a .csv. 

    I haven't tried the transaction APIs yet but there might be a one step action you can run since these APIs contain metadata.

  • kevin.cho
    Answer ✓

    As @JaredDolich says, any straightforward scripting language such as Python is the way to go for this, especially if you want to go and schedule this load. 

     

    In regards to learning material, depending on your programming ability, there are heaps of guides out there. For those that are beginning with their first language, I highly recommend Codecademy, for presenting a very structured approach to the language and to basic programming concepts. 

     

    If you are okay having it less guided and learning from video tutorials, this series of videos from Corey Schafer - YouTube have been heavily recommended.

     

    On another note, when learning new APIs, I highly recommend using Postman | The Collaboration Platform for API Development as a means of developing the necessary API calls - it also has a "Test Script" functionality that allows you to write some Javascript to extend the calls. 

     

    Postman Screenshot.png

     

    Feel free to reach out - I've written a few scripts for myself and my team to automate exactly what you're after. 

  • Misbah
    Answer ✓

    @DaanishSoomar 

     

    Anaplan Transactional APIs can do exactly what you are looking for but we may have to wait for it to become GA. As of now I believe these are in EA (That's what I believe)

Answers

  • @JaredDolich - thank you! It’s reassuring to know that there is a way to accomplish this.

    As someone who has minimal Python experience, would this be something that is easy to learn/code/setup? Any good resources you could point me to that would help create something like this with Python/Anaplan?  

  • Thanks @kevin.cho for that detailed information!

     

    I do have experience working with Postman to test API integrations (specific to Anaplan). 

    I will reach out to you. Thank you! 

  • @DaanishSoomar 

    Here's the best practice article that got me started with Python. It's super easy, and free, to learn but I'll admit it did take me a half a day to set it up on my computer.

    @chase.hippen is the Python master!

    https://community.anaplan.com/t5/Best-Practices/Using-Python-3-with-the-Anaplan-API/ta-p/33150#toc-hId--1188857199

    Chase provides examples for every API with Basic Authentication and with Certificate. Brilliant!!

  • Thanks @JaredDolich!

     

    That’s awesome! I am currently at the struggling to setup part. Luckily I’ve connected with @kevin.cho who’s helping me offline! 

    Appreciate you both again. 

  • @DaanishSoomar 

     

    I get the need to use an API, but why not make it really easy and have a systems module with these two line items defined since neither ID’s actually change?

     

    Rob

  • Hey @rob_marshall,

     

    This was an oversimplified example of what I’m looking for. That would be an easy solution to my question above. However my exact scenario is a bit more complex. 

     

    Can’t reveal too many details of what I am working on in the forums just yet! However I will DM you.

     

    Soon very soon...this will become something I can reveal!  This is in regards to a new tool I am demoing at Slalom very soon, some folks at Anaplan have already gotten eyes on it like Tim Long. 

  • Thanks @Misbah! Yes this is very helpful!