Transactional API tutor
The purpose of this Transactional API tutor script based on Python is to facilitate the learning process of Transactional API Calls using the Anaplan platform. This version contemplates the most common Transactional API calls until November 09, 2020.
Download the Python Script file using the file attachment located to the right of this article.
Steps to use it:
- Make sure the following Python libraries are installed on your environment over Python 3.8.5.
Note: Click here to get guidance on how to install Python packages. - Open the TransactionalAPITutor.py file and change the parameters described below according to your needs. Choose either Username-Password authentication or CA-Certificate-based authentication.
- Username-Password-based authentication parameters:
- CA-certificate-based authentication parameters:
Note: in the case of CA-Certificate-based authentication, make sure that you have the public and private key (.pem) files in place. - Current date is always used to set the Current Period of the selected model.
- A set of Workspaces and Models accessible by your user or certificate will be presented to you during this Python script runtime so the subsequent Transactional API calls in the same script will be generated dynamically based on those parameters.
- Username-Password-based authentication parameters:
Example:
- The underlying Anaplan Transactional API Details are shown.
- Choose the correct option according to the underlying Anaplan Transactional API Endpoint.
- Notice the next underlying Transactional API Details based on the previous selection.
- Close that window by clicking on the red x at the top left corner.
- Notice the underlying Transactional API Response based on the Transaction API details shown on the previous screenshot.
-
Close that window by clicking on the red x at the top left corner and continue the interaction with the API Transactional Tutor according to the script execution.
Feel free to post your feedback and suggestions in the comments below. I am more than happy to hear from you about your experience using the Python-based Transactional API Tutor script.
Additional Reference: Anaplan Integration API V2 Guide and Reference
Comments
-
What a great feature! We used to have a WS allowance issues on several workspaces and I always wanted to set up automated monitoring with alert in case some limits are reached.
I found a workaround with getting that data from hypercare models though.
0 -
Thank you for your feedback on that @Hayk! I do appreciate it.
0 -
Willians.s
This is very helpful, Thank you very much
Only one thing we need to add is , if the private is key is protected with passphrase then we need to pass the passphrase as byte string to the load certificate method
ex:
key = crypto.load_privatekey(crypto.FILETYPE_PEM, anaplan_private_certificate, (keyphrase.encode()))
Thank you
Mohan
1 -
Thank you for your feedback and comment on that @timmapuramreddy! I do appreciate it.
0 -
Hi,
I'm looking at the code you posted in the attachment after the authentication. Could you expand on what it is doing please? I couldn't see where elementID was declared.
for index in range(0, NumberOfItems): # Key commands each step of the operation key = keyword[index] # Generate the set of IDs at the runtime their values are available if key == 'workspaces': workspaceID = elementID elif key == 'models': modelID = elementID elif key == 'modules': moduleID = elementID elif key == 'views': viewID = elementID else: noelementID = 'true' # Generate the API Call URLs if index==0: url[index]='workspaces?tenantDetails=true' elif index==1:url[index]='workspaces/' + workspaceID + '?tenantDetails=true' elif index==2:url[index]='models' elif index==3:url[index]='workspaces/' + workspaceID + '/models/' + modelID + '/currentperiod' elif index==4:url[index]='workspaces/' + workspaceID + '/models/' + modelID + '/currentperiod?date=' + today elif index==5:url[index]='models/' + modelID + '/modules' elif index==6:url[index]='models/' + modelID + '/views' elif index==7:url[index]='models/' + modelID + '/views/' + viewID elif index==8:url[index]='models/' + modelID + '/views/' + viewID + '/data?' elif index==9:url[index]='models/' + modelID + '/processes' else:print('Index out of bond') # Define Current URL current_url = anaplan_api_url + url[index]
thanks
Josh
0 -
Hi @joshuastockwell ,
How are you doing? I hope you are having a great day!
Yes.
The variable elementID is reset for every single for loop iteration according to the following instruction:
elementID = container[currentElement[0]]['id']
The goal is to ensure that this script is dynamic enough for all the element types it goes through modules, views, etc.
Please, let me know if it works for you.
Best Regards,
Willians
0