Discussions

Expand all | Collapse all

Delete File Attachment with API_EditRecord

  • 1.  Delete File Attachment with API_EditRecord

     
    Posted 06-06-2014 22:19

    I have to be missing something here. Cannot delete a file attachment through the API_EditRecord. tried passing these

    _fid_120=false

    _fid_120=

    _fid_120=0


    Any obvious suggestions??





  • 2.  RE: Delete File Attachment with API_EditRecord

    Posted 06-07-2014 05:48
    It is undocumented but you have to specify two parameters for each file attachment you want to delete. In the URL below we are deleting the file saved in the file attachment field with fid=9 and [Record ID#]=43. Here is the format of the unwound URL for a GET request:

    https://<your subdomain>.quickbase.com/db/<your dbid>

    ?act=API_EditRecord

    &rid=43

    &_fid_9=

    &delfile_fid_9=1

    &apptoken=<your apptoken>

    The pastie entry below shows a POST using a jQuery promise that accomplishes the same thing:

    Pastie Database

    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=285


    This was not obvious so its time for a celebratory song:

    http://dualcoremusic.com/nerdcore/upload/dual_core-trust_me.mp3


  • 3.  RE: Delete File Attachment with API_EditRecord

    Posted 12-23-2019 10:34
    Do you know of any way to delete all revisions? I'm hoping to clear up some usage but this method just leaves the attachment in the attachment history.

    ------------------------------
    Jeff Jeff
    ------------------------------



  • 4.  RE: Delete File Attachment with API_EditRecord

    Posted 12-23-2019 10:57
    Try this thread, for Eric's response and post back when you get it working with your code.  If you get a URL working to delete one revision version, but need help stringing several of them together to delete the other versions, post back and I can help with that.

    https://community.quickbase.com/communities/community-home/digestviewer/viewthread?MessageKey=9e640229-f87e-42c1-b243-da04a6381a26&CommunityKey=d860b0f8-6a48-487b-b346-44c47a19a804&tab=digestviewer

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Delete File Attachment with API_EditRecord

    Posted 12-23-2019 12:16
    To test deleting the previous version, so far I've tried adding the following parameters to the URL with no luck:
    &_vid_1=
    &_vid_1=0
    &delfile_vid_1=0
    &_vid_1=&delfile_vid_1=1
    &_vid_1=&delfile_vid_1=0

    Also tried these with "_vid_2" just in case it's one-indexed.

    ------------------------------
    Jeff Jeff
    ------------------------------



  • 6.  RE: Delete File Attachment with API_EditRecord

    Posted 12-23-2019 14:17
    Yes I see that this is not solved.

    I tried this to try to delete the 1st revision, ie the 2nd one on the list, but it did not work.   So right now I'm stumped too.

    var text DeleteFile = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_7="
    & "&delfile_fid_7=1"
    & "&vid=1";


    var text DisplayRecord = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

    $DeleteFile
    & "&rdr=" & URLEncode($DisplayRecord)

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 7.  RE: Delete File Attachment with API_EditRecord

    Posted 06-07-2014 05:52
    Wow, how did you figure that one out?


  • 8.  RE: Delete File Attachment with API_EditRecord

    Posted 06-07-2014 06:11
    I have connections:

    http://goo.gl/jKwGHq


  • 9.  RE: Delete File Attachment with API_EditRecord

     
    Posted 06-10-2014 16:26
    Thank you!  ~singing~


  • 10.  RE: Delete File Attachment with API_EditRecord

    Posted 06-11-2014 18:19
    Hi, thanks in advance, but what if I just wanted to make a button that deleted the file attachment on whichever record id I was viewing? for example -- I have a Table called 'Brady Bunch', and there are 6 rids so far -- each record id  has a picture of that child uploaded to it: Greg (rid_1), Marsha (rid_2), Peter (rid_3), Jan (rid_4), Bobby (rid_5), Cindy (rid_6).

    Question 1:
    I won't know which attachment I want to delete until I get on the actual record. How can I do this in the API script so the rid is more of a variable?

    Question 2:
    Where are you getting the update ID from?

    Question 3:
    When I save, it's telling me I need a 'Type'

    Let me know when/if you have a moment?

    Thanks!


  • 11.  RE: Delete File Attachment with API_EditRecord

    Posted 11-11-2016 21:55
    Because someone else might come along looking for this: here's the XML version:

    <qdbapi>
    <udata>mydata</udata>
       <ticket>auth_ticket</ticket>
       <apptoken>app_token</apptoken>
         <rid>[record_id]</rid>
      <field fid="[field_id]" filename="delete"></field>
    </qdbapi>

    I also added it to my copy of the PHP API wrapper as a modification of API_Edit:

    public function delete_file($rid, $fid) {
      if($this->xml) {
        $xml_packet = new SimpleXMLElement('<qdbapi></qdbapi>');
        $xml_packet->addChild('rid',$rid);
        $xml_packet->addChild('field','');
        $xml_packet->field[0]->addAttribute('fid',$fid);
        $xml_packet->field[0]->addAttribute('filename','delete');

        if ($this->app_token)
          $xml_packet->addChild('apptoken', $this->app_token);
        $xml_packet->addChild('ticket',$this->ticket);
        $xml_packet = $xml_packet->asXML();
        $response = $this->transmit($xml_packet, 'API_EditRecord');
      }
      if($response) {
        return $response;
      }
      return false;
    }


  • 12.  RE: Delete File Attachment with API_EditRecord

    Posted 07-18-2019 16:46
    Cheezits... 3 years later I'm digging around for how to do this and stumble across my own answer on the QB Community board. That'll make ya feel stupid.


  • 13.  RE: Delete File Attachment with API_EditRecord

     
    Posted 07-18-2019 16:50
    did the same thing the other day. join the bandwagon! haha.