Use API to delete entire file attachment history

  • 0
  • 1
  • Question
  • Updated 2 months ago
  • In Progress
  • (Edited)
This question is a follow-up to: https://community.quickbase.com/quickbase/topics/delete-file-attachment-with-api-editrecord. It concerns the use of API_EditRecord to delete attached files from
records. Inspired by the final answer to the aforementioned question, I have been sending out requests with these parameters:

<rid>[rid]</rid>
<field fid="18" filename="delete"></field>
<field fid="24" filename="delete"></field>

This works perfectly well, except for not actually deleting any files. What I get are empty fields whose revision histories now have "(deleted by user)" at the top, with all previous revisions still available and taking up space.

Is there really no way of actually deleting file attachments through the API? While I would prefer a nuke-all option of removing the entire history at once, I'm also open to doing it revision by revision. I looked at the API reference and couldn't find anything, so I'm nervous that this is just not possible, but I thought I'd ask just to be safe.


Photo of Steffen

Steffen

  • 90 Points 75 badge 2x thumb

Posted 8 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
I have not tested at all, but looking at Dan's original post he had the line

&delfile_fid_9=1

I don’t see you using that syntax anywhere.
Photo of Steffen

Steffen

  • 90 Points 75 badge 2x thumb
I thought the filename="delete" attribute was the XML equivalent of that, but maybe not. I'll try the URL approach instead and see if it makes a difference.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,310 Points 50k badge 2x thumb
The Oracle seemed to be saying that you need both

&_fid_9=

&delfile_fid_9=1
Photo of Steffen

Steffen

  • 90 Points 75 badge 2x thumb
Tried that just now, but it makes no difference.
Photo of Daniel Carvallo

Daniel Carvallo

  • 72 Points
any luck with this? 
Photo of Daniel Carvallo

Daniel Carvallo

  • 72 Points
I know its the same as @QuickBaseCoach and the code in different lines should work but its a bit confusing. This worked for me:

&_fid_161=&delfile_fid_161=1
Photo of Eric Mohlman

Eric Mohlman, Employee

  • 500 Points 500 badge 2x thumb
According to the File Attachments documentation: https://help.quickbase.com/api-guide/filemanagement.html there's a VID parameter. You could create a series of API_EditRecord commands combined together to clear version 1, then 2, then 3 (since most file attachment fields only contain three revisions). If you'd like to see how to trigger a series of API calls together in a single button click, please watch the "API Button to Create a Series of Records" section of my advanced formulas course here: https://university.quickbase.com/series/app-building/advanced-use-of-formulas