Skip to main content

Storage

Set up table

Create table with a minimum of an id as a Primary Key and a storagekey column, to store the storage key. The storage key must be either a UUID or String type.

  • We recommend naming the column storagekey but it can be named anything.
  • Only one storagekey column per table that associates to a file.
  • Other associated files can be included in a related table.

Set up file table

  1. Using the Devii portal select the tenant that you used when setting up the storage table.
  2. Select 'Storage' on the left side of the screen.
  3. From the drop down 'table' box, select the table you set up.
  4. From the drop down 'column' box select the column that was set up as the storage key.
  5. Click on the save icon.

Create File Table

Policy

Optionally, you can set up policies to allow users to access and modify the file table, see Policy Rules page.

Introspect tenant

After setting up the file table the underlying database must be re-introspected, click on the 'Introspect database' button and ensure that you recieve a success message. This creates a new object in your roles_PBAC query endpoint for the file table you created,'thefiles: [FileObject]' which will contain an nested array of dictionaries containing information necessary for either entering the information into a URL to create a URL to reference the provided information or retrieve the URL created.

Using the GraphiQL interface provided in the Devii portal, you can access thefiles information by using the Query endpoint to query the storage table with the field thefiles in the query.

The objects within the thefiles(the FileObject):

  • storagekey: A unique identifier for your storage object.
  • filenum: A unique identifier associated with each unique ID of the storage file.
  • filename: The name of the object being uploaded to the storage file.
  • mimetype: The type of object being uploaded to the storage file.
  • size: The size in bytes of the object being uploaded to the storage file.
  • status: The status of the object upload.
  • url: Either a URL used to upload a file object or a complete URL to retrieve the object.
  • headers: Contains information needed to upload a file object, or is set to 'null' if the file object has already been uploaded.
  • additional: Any additional information.
GraphQLJSON Response
query{
avatars{
thefiles{
storagekey
filenum
filename
mimetype
size
status
url
headers
additional
}
}
}
{
"data": {
"avatars": [
{
"thefiles": [
{
"additional": null,
"filename": "Belle5.jpg",
"filenum": "1",
"headers": null,
"mimetype": "image/jpg",
"size": 233457,
"status": "ok",
"storagekey": "de12b1ac3296439b9b2e368569216579",
"url": "https://storage.googleapis.com/devii-tenant320dev/de12b1ac3296439b9b2e3685692165791?Expires=1722281934&GoogleAccessId=storage-bucket-accessor%40nomadic-rite-375921.iam.gserviceaccount.com&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&response-content-disposition=attachment%3B+filename%3D%22Belle5.jpg%22"
},
{
"additional": null,
"filename": "Belle5.jpg",
"filenum": "2",
"headers": "{\"content-type\": \"image/jpg\", \"key\": \"de12b1ac3296439b9b2e3685692165792${filename}\", \"bucket\": \"devii-tenant320dev\", \"GoogleAccessId\": \"storage-bucket-accessor@nomadic-rite-375921.iam.gserviceaccount.com\", \"policy\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\", \"signature\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxOIw==\"}",
"mimetype": "image/jpg",
"size": 233457,
"status": "pending",
"storagekey": "de12b1ac3296439b9b2e368569216579",
"url": "https://devii-tenant320dev.storage.googleapis.com"
}
]
}
]
}
}