[IN REVIEW] Consuming Anaplan Rest API 2.0 from Java
Java Spring Boot Framework Provides an easy way to Interact with the API. It can call any application Base API and process the Response according to our needs. This article explains how we can Invoke Anaplan Rest API using Java Spring Boot Frame Work.
Tools to be Installed
Java: Java 1.8 would be the preferred version.
Postman: This is a tool to test API’s.
STS: Spring Tool Suite (Preferred 3.9 Version).
List of Actions You Can Perform Using the Below Code
Run an import action.
Run a process.
Run an export action.
Run a delete action.
Before executing the code, we need to setup up a few parameters in the application.properties file including authentication credentials, workspace ID, and model ID.
File Upload needs a file ID and the data we need to upload as an input. Make sure the delimiter we have chosen in Anaplan is the same for the data we are uploading, separated by comma or tab, depending on what we have chosen in Anaplan.
Once we have uploaded the file, the data needs to be reflected in the module. To achieve this, we need to run an Import Action. To run an Import Action, we need the Import Id. Get the Import ID using the below API, and use it in our Custom API. In response, we will get the Success Message after the import action has completed.
We can run a process adding Import Action to the process. To run a process, we require Process ID. Get Process ID by using the below API, and use it in our Custom API. In response, we will get the Success Message once the process action has completed.
To run an Export Action, we need an Export ID, which we will get from Anaplan Export API. Once the Export Action has completed, it will send the Success Message. We can customize the code in a way to check whether Export has completed or not, by calling Action Status API.
In a similar manner, we need to create end points for the source application and transform the data to our needs, and we can send data into Anaplan using the above approach. We can use the above implementation as an alternative approach for an integration solution, instead of using Integration tool.
Note: All the above implementations are to show how to call the Anaplan Rest API using java Spring Boot Framework. We can make it more customized for every action, depending on our needs of the application.