Anaplan API Live: Unlock the power of Anaplan APIs with this comprehensive instructional guide
Author: Anirudh Nayak is the co-founder of Elite EPM and an Anaplan Community Boss.
Introduction
Whether you're a model builder, a business owner, or an enthusiastic Anaplan user, harnessing the power of Anaplan APIs can be a game-changer. To help you on this journey, I am excited to introduce a new instructional guide in the form of a Jupyter notebook that demystifies the world of Anaplan APIs.
Unlocking the hidden potential
Anaplan offers a wide array of functionalities that can be leveraged through their APIs, but understanding and using these APIs can be a daunting task for many. This guide is designed to bridge the knowledge gap and empower you with the skills to use APIs
What the instructional guide covers
- Live environment: Run APIs live in your browser and get instant feedback. Automatically document runs and iterate through requests.
- All Anaplan APIs: All Anaplan APIs up until Oct 2023 are in the guide. Any future APIs will also be added to this resource.
- Authentication and security: Security is paramount when dealing with APIs. This guide explains all possible authentication methods and when and how to use them.
Why use it
Anaplan API Live is designed with both beginners and experienced users in mind. It offers a clear, step-by-step approach that enables you to fully unlock the potential of APIs. The benefits of using this guide:
- Save time and effort: No more struggling with trial and error. The guide provides the knowledge you need to run any given API.
- Stay competitive: In today's fast-paced business environment, staying ahead of the competition is critical. Leveraging Anaplan APIs can give you that edge.
- Boost ROI: Maximize the ROI on your Anaplan subscription by utilizing the excellent Transactional and Bulk APIs to their fullest potential.
- Python code: Easily understand and use the python code in your project. Most API requests are less than 10 LOC.
- Flexibility: The included notebook can be run in a live instance immediately or you can download it onto your local machine for added privacy. You can modify the code inline and experiment live!
How to access the guide
Anaplan API Live is freely available under the MIT License. You can find it here:
Simply navigate to the link, and click on the badge (pictured below), and get started! Alternatively click on this link to go to the latest release and click on the zip file to download locally.
Prerequisites
- Read the official Apiary docs from Anaplan
- Jupyter Lab knowledge. Quick intro video
- Basic Python knowledge is helpful but not mandatory
- What are python comment statements and how to uncomment code
- What are variables and filling in empty variables
- What is a web request (GET, POST, PUT)
- Web Request error and success codes
- What are python comment statements and how to uncomment code
- What is JSON and how to read JSON objects
- Access to an Anaplan workspace and model, preferably with Workspace Administrator
Demo images
First launch:
Run code example:
View more demos here.
Conclusion
Anaplan APIs are the key to unlocking the full potential of Anaplan. With this guide, you can become proficient in using these APIs, thereby supercharging your experience. I’m very excited to share this resource with the Anaplan community and look forward to hearing about the amazing things you'll achieve with your newfound knowledge. Visit the GitHub repo and embark on your journey to API mastery today.
For any questions, drop a comment in the issues section or post a comment in this article and I will get back to you ASAP!
Addendum:
Variables
Variables are elements in code that can be reassigned frequently. We use several variables throughout this notebook. Some examples are workspace ID, model ID, and authentication token. When looking at code sections, variables can be spotted by a name that is not used anywhere in the preceding code sections and by an ‘=’ sign immediately after the name. Here is an example from subsection 3 of Section II-A
The accessWS
and accessM
are names of the variable and by default they are empty variables. You can fill them up with the WS ID and Model ID of your choice. Later on, if you want to check a different model, these 2 variables can be reassigned which is what makes them ‘variable’. The rest of the notebook will then use updated variables
Note that each code section needs to be re-executed if variables are altered. This can be done with CTRL+Enter or with the Run button in the toolbar
Authentication token
Now let’s understand how we make use of variables to ‘store’ an authentication token. Going to subsection 1 of Section I, we see this for Basic Authentication
The variable c will load in the username and password input in the file credentials.txt
Change the username and password in the provided file in your environment and save the file. Make sure it’s formatted to look like username:password
Now that we have the correct login, run this section. The username:password will be loaded to a variable named FullCreds
. You should see ‘↓↓ Ready ↓↓’
In the next code section, Python will parse fullCreds
and convert them into Base64 encoded formatting (1). This variable is named cred_string
and passed to the authentication server which responds with a valid token (2) in the form of a json response. Lastly we create the auth
variable which we use throughout the rest of the notebook (3)
This gif demonstrates a successful run:
Look at any other request and you should see the auth variable in the authentication header which always encapsulates a valid login
Custom Variables
In Python, it’s very easy to create your own variables. You can do this in an existing code section or create your own code section and use the variables already defined in the notebook.
Below I create custom variables and then print my full name, all based on the User API request. First I run the User API which outputs a variable named user
. Then in a new code section, we slice the json using box brackets assigning required variables step by step. The path to First name is user.json[‘user’][‘firstName’] etc. Then execute the print statement