Search code examples
infusionsoft

Infusionsoft File Box - Delete File


I am new to the infusionsoft API and I am attempting to maintain some files in a Contacts' File Box...

According to the API documentation:

https://developer.infusionsoft.com/docs/read/File_Service

I can ADD a file I can RENAME a file I can REPLACE a file

There appears to be no way of deleting a file or getting a list of files with their details..

I want to be able to replace or delete previous file and upload a new one.

Does anyone know a way of doing this?

Thanks


Solution

  • Welcome to the wonderful world of the data service and interacting with tables! Specifically, you're going to want to use DataService.delete to delete the file in the database. You can also use DataService.query to get File details.

    Here's an example for deleting a file, via the PHP SDK:

    $file_id = 123;
    $deleted = $app->dsDelete( 'FileBox', $file_id );
    

    That's it! You can do a LOT with the Data Service.

    EDIT: It looks like the FileBox table only allows Read access...Silly. Completely deleting the file via the API appears to be impossible. Gold Star, InfusionSoft.

    An alternative for "deleting" a file would be to replace the file contents with an empty string. Something like:

    $file_id = 123;
    $deleted = $app->replaceFile( $file_id, '');
    

    Note that this won't actually delete the file entry from the table...