Discussions

Expand all | Collapse all

Use API to delete entire file attachment history

  • 1.  Use API to delete entire file attachment history

    Posted 08-15-2018 08:07
    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.




  • 2.  RE: Use API to delete entire file attachment history

    Posted 08-15-2018 10:43
    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.


  • 3.  RE: Use API to delete entire file attachment history

    Posted 08-15-2018 11:41
    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.


  • 4.  RE: Use API to delete entire file attachment history

    Posted 08-15-2018 11:57
    The Oracle seemed to be saying that you need both

    &_fid_9=

    &delfile_fid_9=1


  • 5.  RE: Use API to delete entire file attachment history

    Posted 08-16-2018 08:21
    Tried that just now, but it makes no difference.


  • 6.  RE: Use API to delete entire file attachment history

    Posted 02-25-2019 21:18
    any luck with this? 


  • 7.  RE: Use API to delete entire file attachment history

    Posted 02-25-2019 22:47
    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


  • 8.  RE: Use API to delete entire file attachment history

    Posted 03-04-2019 15:03
    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