Export in Anaplan API - What to do next?

dfpaezo
New Contributor

Export in Anaplan API - What to do next?

Hi everyone!

 

I'm new working with Anaplan and also with APIs. i've been managing it quite well but I'm stucked in one step hope you can help me overcoming this.

 

I've already get al chunks of the export however I don't know how to download the data... the file exported 26 chunks and I get chunk id 0, 1, 2 and so on. So the lastest request that I've made so far is:

https://api.anaplan.com/2/0/workspaces/workspaceid/models/modelid/files/taskid/chunks/1

 

And it does shows me data but... what to do next? I need to concatenate with other 25 chunks and donwload them.

 

I'm using Postman btw.

 

Thanks in advance for your help.

6 REPLIES 6
kevin.cho
Certified Master Anaplanner

Re: Export in Anaplan API - What to do next?

You will need to loop through the number of chunks you are requiring to download, and then concatenate the result together. Chunk counts start at 0 remember, so if you have 26 chunks it will be from 0 to 25. 

 

Within Postman, I think you could use the Collection Runner Using the Collection Runner | Postman Learning Center to loop through and then store the response from each successive request using the Tests Scripts section to eventually concatenate through, but this may be a bit convoluted. 

 

I personally use Postman more for testing individual requests - anything repeatable or productionised, I would move to something else. If you're just automating exports/downloads, then Anaplan Connect is a good option, otherwise building out a Python app or other is also an option. 

dfpaezo
New Contributor

Re: Export in Anaplan API - What to do next?

Thanks kevin.cho for your prompt response.

 

I feel overwhelmed trying to understand this. 😞 I need to do exactly as you told. Automate exports from my Anaplan model. Is there any documentation how to use python with Anaplan? I dont know where and how to start.

 

Thank you in advance.

kevin.cho
Certified Master Anaplanner

Re: Export in Anaplan API - What to do next?

Hi @dfpaezo  - If you're just trying to automate exports, I wouldn't try to re-invent the wheel - try taking a look at Anaplan Connect, which is a supported Java based CLI tool that you can then combine with schedulers such as Windows Task Scheduler or cron jobs, depending on the operating system you are working with. Anaplan Connect - Anaplan Technical Documentation  

dfpaezo
New Contributor

Re: Export in Anaplan API - What to do next?

Hi there @kevin.cho ,

 

I read Anaplan Connect documentation and ain't difficult so far. Running my first script haven''t been successfull at all. May I share with you some details?

 

This is the first script on documentation that may run but unfortunately it doesn't

 

@echo off
rem This example loads a source text file and runs an Anaplan import into a module.
rem For details of how to configure this script see doc\Anaplan Connect User Guide.doc
set AnaplanUser="periscope@abbott.com:password"
set WorkspaceId="8a8194824045c4240140a4a15253610d"
set ModelId="CF6A1AC04E0D4F5686B95E137BA57938"
set Operation=-service "https://api.anaplan.com" -auth "https://auth.anaplan.com"
-file "testing.txt" -put "C:\Users\Diego\Documents\Anaplan\testing.txt" -import "C:\Users\Diego\Documents\Anaplan\importsample.txt" -execute
-output "C:\Users\Diego\Documents\Anaplan\My Errors.txt"
rem *** End of settings - Do not edit below this line ***
setlocal enableextensions enabledelayedexpansion || exit /b 1
cd %~dp0
if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%
@echo %Command%
cmd /c %Command%
pause
 
The output that i got, is Error 7832 (Whenever I run the script throws another number) error.PNG
 
I don't know why I'm doing wrong 😞
 
 
kevin.cho
Certified Master Anaplanner

Re: Export in Anaplan API - What to do next?

Can you share a screenshot of your entire Command Prompt window? Just to see how you are calling the script itself 

ben_speight
Super Contributor

Re: Export in Anaplan API - What to do next?

The -import command line switch is used to specify an import in the model, not a file on your computer. Not sure why the program is unhappy with the command line arguments, perhaps try something simple like listing available files in the model first, then build it up step by step.