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:

  1. Create the export manually and run the action in Anaplan. (Use Postman or Python to get the fileID)
  2. From the API, Delete The File
  3. From the API, Run the Export Action
  4. 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

  • @JaredDolich 

     

    Below are the steps i follow 

     

    1. Create the export manually and run the action in Anaplan. (Use Postman or Python to get the fileID)
    2. From the API, Run the Export Action
    3. Get the Task ID of the executed action 
    4. Check if task status changes to complete 
    5. 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 . 

     

  • @karank 

    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.

     

  • Try this if you haven't 

     

    1. Re-upload the file as workspace admin
    2. Set the file to everyone 
    3. Run API  (without delete)
    4. Change value 
    5. Run API (without delete)
    6. Check 3 and 5 value , file should be diff as you changed some values in output 
    7. wait for 48 hrs 
    8. Change value 
    9. Run API (without delete)
    10. You should have updated file i.e whatever you updated in step 8 

    You should get updated file with changed value