System Table & better docs for Files

It would be really nice if there was a System Table for Files (like there is one for Users).

To create, read, download & delete files from there, rather than only from the table they are referenced in.

Also there’s not a lot of docs on the File storage, besides how to create a file. Could we have some more docs on how to access them as well :)? E.g. if you wanted to get a permanent link to a file.

An example on how to “fetch” and read e.g. a .json file from a custom 8base function would be nice to have as well!

PS. Having an in-site viewer for .json files would be a really nice addition!

PPS. Being able to do a trigger on file.created would be amazing.

2 Likes

I also recently had a question in regards to orphaned files, which are hard to find and delete. I eventually did it manually. A Files table would be very helpful! I imported the properties app data, and never really thought about how much it was using – About 130 MB. Not huge but not easy to manage / delete items.

1 Like

Hey guys! I have awesome new… there is a file’s table :slight_smile:

Run this in the API explorer.

query {
  filesList {
    items {
      fileId
      public
      shareUrl
      downloadUrl      
    }
  }
}

That said, right now the Files table is NOT visible in the data builder (whereas the User’s table is). We can look at exposing it. I’ll ask the guys about why it’s not exposed.

File uploads are currently kind of tricky because of the integration with FileStack. This is something we’re working on simplifying soon. As right now you need to run this query to get the upload information, that you can then use with the create file mutation (which expects values returned by FileStack):

/* Credentials to use with filestack API */
query {
  fileUploadInfo {
    policy
    signature
    apiKey
    path
  }
}
/* Mutation to create file record in 8base */
mutation {
  fileCreate(data: {
    fileId: "FILESTACK_FILE_ID"
    filename: "name.png"
  }) {
    downloadUrl
  }
}

Love the idea of an insight viewer for JSON docs!

I’m pretty sure that we can set a trigger for file create… I could 100% be mistaken.

2 Likes