Download A File Using API V1.3 - Do I Always Need to Delete File First?
Hi Anaplanners!
I finally have gotten around to asking this question that's been bothering me since I started using the APIs to download a file. I get inconsistent results when I test this on my own so I thought I'd ask the Community.
The use case: I want to download a file (export) based on a view from a module using API v1.3 (Basic Auth is fine)
The most reliable steps I found to get an updated file download from a changed view is to:
- Create the export manually and run the action in Anaplan. (Use Postman or Python to get the fileID)
- From the API, Delete The File
- From the API, Run the Export Action
- From the API, Download The File
My question is do I always need to delete the file first before running the export? If not, what are the conditions that necessitate a file deletion first?
Two things to consider:
- I know delete file only works on private files. I'll get a 204 error if I try to delete an "admin" or "everyone" file. If I use an "everyone" file, can I just skip the delete file and always get an updated copy?
- If the view changes that creates the export, some type of action seems to be needed to get the new view. Is that a delete file? If that's the case, how do i do this if I use an "everyone" export? Do I have to run it manually first in Anaplan?
As always, thanks for your help!
Answers
-
Below are the steps i follow
- Create the export manually and run the action in Anaplan. (Use Postman or Python to get the fileID)
- From the API, Run the Export Action
- Get the Task ID of the executed action
- Check if task status changes to complete
- Once complete only then Download The File
I do not delete file . Unsure why would you delete file . Will be interesting to know if there are any reasons .
1 -
Thank you for that response!
I think something happens when the view that is used to create the export changes.
For some reason when I run the export and the download actions via the API, I get the old data. But if I delete the file first (assuming I can) then run the export and download, I get the new data in the new view.
The problem is I can't make this happen consistently. Sometimes I just have to re-run the export manually from within Anaplan to get it to work.
So between the changing view and the type of save (private, admin, everyone) there's a specific combination that needs to be used.
0 -
Try this if you haven't
- Re-upload the file as workspace admin
- Set the file to everyone
- Run API (without delete)
- Change value
- Run API (without delete)
- Check 3 and 5 value , file should be diff as you changed some values in output
- wait for 48 hrs
- Change value
- Run API (without delete)
- You should have updated file i.e whatever you updated in step 8
You should get updated file with changed value
1